Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

404 error with useFetcher() on Vercel when switching runtime between routes #10494

Open
styxlab opened this issue Feb 24, 2025 · 2 comments
Open

Comments

@styxlab
Copy link

styxlab commented Feb 24, 2025

Reproduction

Reproduction:
https://github.com/styxlab/useFetcher-404-on-vercel

Demo:
https://use-fetcher-404-on-vercel.vercel.app/

Notes:

  • This problem exists regardless of the lazyRouteDiscovery setting
  • The example uses fetcher.Form, but same issue is present with fetcher.submit(), etc.
  • Everything works fine on local builds

System Info

remix 2.15.3, deployed to Vercel, node 22

Used Package Manager

npm

Expected Behavior

No 404 error when using useFetcher()

Actual Behavior

404 error when using useFetcher() on Vercel with changing runtimes

Browser Console (client)

Object { status: 404, statusText: "Not Found", internal: false, data: 'Error: No route matches URL "/api/callback"' }
​
data: 'Error: No route matches URL "/api/callback"'
​
internal: false
​
status: 404
​
statusText: "Not Found"
​
<prototype>: Object { … }
[components-BfSI4_fj.js:156:487](https://use-fetcher-404-on-vercel.vercel.app/assets/components-BfSI4_fj.js)
Object { status: 404, statusText: "Not Found", internal: false, data: 'Error: No route matches URL "/api/callback"' }
​
data: 'Error: No route matches URL "/api/callback"'
​
internal: false
​
status: 404
​
statusText: "Not Found"
​
<prototype>: Object { … }
[components-BfSI4_fj.js:156:487](https://use-fetcher-404-on-vercel.vercel.app/assets/components-BfSI4_fj.js)
Uncaught (in promise) DOMException: The operation was aborted. 
    Jt https://use-fetcher-404-on-vercel.vercel.app/assets/components-BfSI4_fj.js:49
    Ll https://use-fetcher-404-on-vercel.vercel.app/assets/components-BfSI4_fj.js:49
    Dt https://use-fetcher-404-on-vercel.vercel.app/assets/components-BfSI4_fj.js:49
    kp https://use-fetcher-404-on-vercel.vercel.app/assets/components-BfSI4_fj.js:49

Server Logs

Error: No route matches URL "/api/callback"
    at getInternalRouterError (/var/task/node_modules/@remix-run/router/dist/router.cjs.js:5228:59)
    at Object.query (/var/task/node_modules/@remix-run/router/dist/router.cjs.js:3807:19)
    at Object.singleFetchAction (/var/task/node_modules/@remix-run/server-runtime/dist/single-fetch.js:61:38)
    at handleSingleFetchRequest (/var/task/node_modules/@remix-run/server-runtime/dist/server.js:254:52)
    at requestHandler (/var/task/node_modules/@remix-run/server-runtime/dist/server.js:143:24)
    at Server.default (file:///var/task/build/server/edge-eyJydW50aW1lIjoiZWRnZSJ9/server-index.mjs:87:26)
    at /opt/rust/nodejs.js:16:5714
    at AsyncLocalStorage.run (node:internal/async_local_storage/async_hooks:91:14)
    at /opt/rust/nodejs.js:16:5702
    at AsyncLocalStorage.run (node:internal/async_local_storage/async_hooks:91:14)
@styxlab
Copy link
Author

styxlab commented Feb 24, 2025

Similar to #10492 but different in that lazyRouteDiscovery flag does not change anything here

@styxlab
Copy link
Author

styxlab commented Feb 25, 2025

Note: The 404 error vanishes when switching off both single fetch and lazyRouteDiscovery:

 v3_singleFetch: false,
 v3_lazyRouteDiscovery: false,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant