-
Notifications
You must be signed in to change notification settings - Fork 20
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
Enable installGlobals({ nativeFetch: true }) when singleFetch is active #122
Comments
I apologize for the confusion in my original post. After further investigation, I've discovered some new information that I'd like to share as an update to this issue:
Given these new findings, I have some additional questions:
I apologize again for any confusion caused by my initial post. I hope this additional information helps in addressing the underlying issues. Thank you for your continued support and attention to this matter. |
To be determined. We're planning on evaluating whether it's safe to enable by default under certain conditions, but haven't gotten that far yet. It may end up remaining opt-in via this env var though, in which case we would document it.
I haven't seen that one personally. If you could provide a repro then we could take a look.
Nope. Set the env var and then native fetch will be used in your serverless functions. |
Thank you for the detailed explanation. This information is very helpful.
I understand points 1, 2, and 4 clearly now. The clarification on the use and implementation of Regarding point 3:
It seems the issue occurs when attempting to fetch with streaming from OpenAI on the server side. I'll create a reproduction and open a separate issue to address this specific problem in more detail. Thank you again for your support and attention to this matter. |
Issue Description
Since Remix 2.9, the
singleFetch
option has been introduced. When this option is enabled, it requiresinstallGlobals({ nativeFetch: true })
to be set in the runtime for proper functionality. However, the current implementation of @vercel/remix doesn't allow for this configuration, causing issues when deploying to Vercel.Current Behavior
singleFetch
option works locally but fails when deployed to Vercel.installGlobals({nativeFetch:true})
causes the deployment to fail on Vercel (while working locally). ref:TypeError: headers.getSetCookie is not a function
#109installGlobals();
inglobals.ts
on the server side, preventing application-level configuration: https://github.com/vercel/remix/blob/main/packages/vercel-remix/globals.ts#L2Workaround
Currently, we're applying a patch to
server.js
usingpnpm patch
to enable the required functionality: https://github.com/techtalkjp/techtalk.jp/pull/27/filesHowever, this workaround requires updating the patch every time the package version changes, which is cumbersome and not sustainable.
Proposed Solution
We request a modification to @vercel/remix that automatically enables
installGlobals({ nativeFetch: true })
whensingleFetch
is active during server execution. Specifically:singleFetch
is enabled in the Remix configuration.singleFetch
is active, useinstallGlobals({ nativeFetch: true })
instead of the current hardcodedinstallGlobals();
.This change would resolve the current issues and prepare for future compatibility, especially considering the direction of Remix v3.
Future Considerations
Given that Remix v3 (with React Router v7) is expected to have
singleFetch
enabled by default, the current implementation of @vercel/remix will likely need to change regardless. This issue presents an opportunity to address both current and future needs.Questions
nativeFetch: true
setting whensingleFetch
is active in @vercel/remix?Thank you for your attention to this matter. We look forward to your response and any potential solutions.
The text was updated successfully, but these errors were encountered: