#/@handle route not giving a 404 on Netlify

6 messages · Page 1 of 1 (latest)

gloomy ruin
#

@glacial gorge <@&1362126129594630164>

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",

vite.config.ts

...
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

netlify.toml file

  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

glacial gorge
#

can you share a full project that our netlify colleagues can use for debugging?

gloomy ruin
#

Hey @glacial gorge 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
glacial gorge
#

interesting. why is this necessary?

cloud nexus
#

🤔 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