T
TanStack3mo ago
rare-sapphire

Test deploy of v1.121.30 to AWS Amplify gives error "Only HTML requests are supported here"

In before load. Fetching session data gives the above error from the serverFn
beforeLoad: async ({ search }) => {
const serverSession = await fetchServerSessionFn({
data: { key: import.meta.env.VITE_APP_EMPLOYER_AUTH_TOKEN_KEY },
});
if (serverSession.token && serverSession.isFullyOnboarded) {
throw redirect({ to: search.redirect || dashboardRoute.to });
}
},
beforeLoad: async ({ search }) => {
const serverSession = await fetchServerSessionFn({
data: { key: import.meta.env.VITE_APP_EMPLOYER_AUTH_TOKEN_KEY },
});
if (serverSession.token && serverSession.isFullyOnboarded) {
throw redirect({ to: search.redirect || dashboardRoute.to });
}
},
ServerFn
export const fetchServerSessionFn = createServerFn()
.validator((data: { key: string }) => data)
.handler<AuthSessionType>(async ({ data }) => {
const namedKey = await uniqueizeNameKey({ data: { key: data.key } });
const session = await useAppSession(namedKey);
return session.data;
});
export const fetchServerSessionFn = createServerFn()
.validator((data: { key: string }) => data)
.handler<AuthSessionType>(async ({ data }) => {
const namedKey = await uniqueizeNameKey({ data: { key: data.key } });
const session = await useAppSession(namedKey);
return session.data;
});
No error during development/local machine
No description
12 Replies
like-gold
like-gold3mo ago
do you have server logs?
rare-sapphire
rare-sapphireOP3mo ago
For now no.
like-gold
like-gold3mo ago
maybe request.url is not correctly populated on that deployment target since that is required to dispatch in start does normal routing work? for SSR
rare-sapphire
rare-sapphireOP3mo ago
We have similar app v1.121.0 on Amplify and routing works for SSR.
like-gold
like-gold3mo ago
would be helpful if you can narrow down the exact version that broke it
rare-sapphire
rare-sapphireOP3mo ago
Here "@tanstack/react-router": "^1.121.27" "@tanstack/react-router-with-query": "^1.121.27" "@tanstack/react-router-devtools": "^1.121.27" "@tanstack/react-start": "^1.121.30"
like-gold
like-gold3mo ago
yeah but did 1.121.29 work?
rare-sapphire
rare-sapphireOP3mo ago
no
like-gold
like-gold3mo ago
so which was the latest version that worked?
rare-sapphire
rare-sapphireOP3mo ago
The version we have deployed on AWS Amplify, @tanstack/react-start@^1.121.0, works well and server functions operate as expected. However, after adding more test routes, including a pathless layout inside a group, we noticed that type inference for child routes was broken. To address this, we upgraded to @tanstack/react-start@^1.121.29 and then to 1.121.30. After deploying these updates, we got the error "Only HTML requests are supported here" @tanstack/react-start@^1.121.0 on AWS amplify on our staging server works with no issue. SSR works
like-gold
like-gold3mo ago
can you identify the exact patch version that was the last working for you?
rare-sapphire
rare-sapphireOP3mo ago
I was able to resolve the issue with the 500 error on our deployed TanStack Start SSR app. The problem was caused by our AWS Amplify "Rewrites and redirects" settings—specifically, we had an extra regex rule that was routing non-HTML requests to the SSR handler, which caused the error. After updating the rewrites (just a single rule rewriting all unmatched routes to /index.html), everything works as expected. Thanks for the help!

Did you find this page helpful?