T
TanStack•2w ago
secure-lavender

/@handle route not giving a 404 on Netlify

@Manuel Schiller @Netlify (Partner) What I would like I want the following route pattern /@username What I have done Stack: Tanstack Start
"@netlify/vite-plugin-tanstack-start": "^1.1.12",
"@tanstack/react-query": "^5.87.4",
"@tanstack/react-router": "^1.135.2",
"@tanstack/react-start": "^1.135.2",
"@tanstack/zod-adapter": "^1.135.2",
"@netlify/vite-plugin-tanstack-start": "^1.1.12",
"@tanstack/react-query": "^5.87.4",
"@tanstack/react-router": "^1.135.2",
"@tanstack/react-start": "^1.135.2",
"@tanstack/zod-adapter": "^1.135.2",
vite.config.ts
...
export default defineConfig({
server: {
port: 3000,
},
plugins: [
tsConfigPaths(),
tanstackStart(),
netlify(),
viteReact(),
tailwindcss(),
],
})
...
export default defineConfig({
server: {
port: 3000,
},
plugins: [
tsConfigPaths(),
tanstackStart(),
netlify(),
viteReact(),
tailwindcss(),
],
})
Folder/file structure
- src
-- routes
--- @{$handle}
---- route.tsx
export const Route = createFileRoute('/@{$handle}')
---- index.tsx
- src
-- routes
--- @{$handle}
---- route.tsx
export const Route = createFileRoute('/@{$handle}')
---- index.tsx
netlify.toml file
command = "vite build"
publish = "dist/client"
command = "vite build"
publish = "dist/client"
What is the problem /@handle this is not working on Netlify however works in local development I am getting a 404 error on netlify
5 Replies
sensitive-blue
sensitive-blue•2w ago
can you share a full project that our netlify colleagues can use for debugging?
secure-lavender
secure-lavenderOP•2w ago
Hey @Manuel Schiller this was resolved by Netlify support. I had posted a question on their support channel as well. The fix was this add the following to netlify.toml file
from = "/@*"
to = "netlify/functions"
status = 200
from = "/@*"
to = "netlify/functions"
status = 200
sensitive-blue
sensitive-blue•2w ago
interesting. why is this necessary?
exotic-emerald
exotic-emerald•2w ago
🤔 That netlify.toml file shouldn't work unless something else is misconfigured in your project and the errors are sort of... cancelling each other out! can you share more details of your directory structure? not src but basically everything else
secure-lavender
secure-lavenderOP•2w ago
Sure
No description

Did you find this page helpful?