Skip to content

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

Open
@styxlab

Description

@styxlab

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions