Comments (9)
I have enabled Single Fetch in my Remix (with Vite) project. It's working locally, but not on Vercel. I am seeing headers.getSetCookie
is not defined error, and a blank page.
I am using Node 20. I am calling installGlobals({ nativeFetch: true })
in vite.config.ts
from remix.
After looking at this a bit more, even a simple:
export const loader = () => {
return json({})
}
throws the same error:
TypeError: headers.getSetCookie is not a function or its return value is not iterable
at proxyResponseToResponseStub (file:///home/projects/remix-run-remix-tfwhw2/node_modules/@remix-run/server-runtime/dist/single-fetch.js:292:25)
at eval (file:///home/projects/remix-run-remix-tfwhw2/node_modules/@remix-run/server-runtime/dist/single-fetch.js:61:9)
at async Promise.all (index 1)
at async eval (file:///home/projects/remix-run-remix-tfwhw2/node_modules/@remix-run/server-runtime/dist/single-fetch.js:39:19)
at async callDataStrategyImpl (file:///home/projects/remix-run-remix-tfwhw2/node_modules/@remix-run/router/dist/router.cjs.js:4169:17)
at async callDataStrategy (file:///home/projects/remix-run-remix-tfwhw2/node_modules/@remix-run/router/dist/router.cjs.js:3702:19)
at async loadRouteData (file:///home/projects/remix-run-remix-tfwhw2/node_modules/@remix-run/router/dist/router.cjs.js:3677:19)
at async queryImpl (file:///home/projects/remix-run-remix-tfwhw2/node_modules/@remix-run/router/dist/router.cjs.js:3522:20)
at async Object.query (file:///home/projects/remix-run-remix-tfwhw2/node_modules/@remix-run/router/dist/router.cjs.js:3416:18)
at async handleDocumentRequest (file:///home/projects/remix-run-remix-tfwhw2/node_modules/@remix-run/server-runtime/dist/server.js:222:15)
from remix.
Found the culprit for the first issue. installGlobals
without nativeFetch uses remix's own polyfill, which doesn't implement headers.getSetCookie
. The docs aren't clear on whether or not installGlobals
should be called for custom servers.
from remix.
I am having the same problem with vercel.
Here is my reproduction code.
https://github.com/coji/remix-vercel-single-fetch-test
I was wondering where to put installGlobals since it's not a custom server.
from remix.
I commented on the Vercel Fork, but I will leave it there in case it may help.
I'm getting this error too. I tried to use node 20 if it solves the issue, but it's the same.
The server is not accessible (Just blank screen).
Mine is just a local dev environment.
I tried to dig deeper a little bit and there I see this line:
Even the comments themselves acknowledge the presence of certain typing issues.
I want to contribute to solve this issue, but i'm not a yet great JS dev myself 😅 .
from remix.
Regarding the headers issue - It looks like we may have missed this call out in the docs and only included it in the release notes: https://github.com/remix-run/remix/blob/main/CHANGELOG.md#single-fetch-unstable
Single fetch requires using the built-in fetch on node 20, or passing the new option to installGlobals({ nativeFetch: true })
in your custom server.
I’ll get that added to the docs 👍
Update Added to the docs in #9335
from remix.
Just came back here to say the same thing. Rereading the release notes and saw it.
from remix.
To recap here, I think this can be closed out?
- was due to a missing
installGlobals({ nativeFetch: true })
- we added a call out to the docs inhttps://github.com//pull/9335. - is a duplicate of #9314 and being addressed in #9349. We are adding the
response
stub to resource routes to eliminate the ambiguity, and I think we are also probably going to look into aLoaderFunctionArgs
override in thefuture/single-fetch.d.ts
file so we don't have to introduceresponse
as optionl when apps have not opted into single fetch.
Please let me know if anything is still outstanding and we can re-open!
from remix.
There's an issue for the problem with Vercel at vercel#109 where I posted a workaround.
from remix.
Related Issues (20)
- "Remix (with Vite and Cloudflare)" template suffers multiple issues in dev mode (hard refresh, <Form> hard refresh, ..)
- Unable to use MUI icons with Remix HOT 1
- cannot import server module in meta HOT 3
- content in meta gets double encoded
- Single Fetch: json serialization is unstable HOT 1
- Error loops when clientLoader crashes after setting environment variables in root.tsx HOT 1
- Erronous import of identically named files HOT 3
- Single Fetch: useFetcher without generics arg triggers TS error `instantiation is excessively deep...` HOT 1
- Deployment to Vercel causes a build panic when using manual route configuration HOT 2
- Vite HMR: Vanilla Extract styles are lost after rendering an error boundary
- Scrolls the page down only if the current scroll position is 0
- Issues with npx create-remix@latest on Safari
- request.signal is never fired in dev server
- Streaming break when load async zone.js HOT 2
- docs - createCookieSessionStorage says commitSession not needed HOT 3
- Error Boundary <Links> conflicting with Root <Links> HOT 1
- Error: No route matches URL "/cart.json" HOT 2
- Inconsistent bundling of css assets between builds (Vite, Stylex) HOT 1
- Single Fetch: returning `null` from resource route loader leads to error HOT 1
- Loader Redirects are inconsistent between Dev / Prod HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from remix.