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

Cannot deploy remix-utils to edge #94

Open
penx opened this issue Mar 19, 2024 · 7 comments
Open

Cannot deploy remix-utils to edge #94

penx opened this issue Mar 19, 2024 · 7 comments

Comments

@penx
Copy link

penx commented Mar 19, 2024

I am using remix-utils/client-only in a route:

https://github.com/sergiodxa/remix-utils

import { ClientOnly } from "remix-utils/client-only";

export const config = { runtime: "edge" };

export default function Index() {
  return <ClientOnly>{() => <div>Example</div>}</ClientOnly>;
}

This errors during deployment:

Error: The Edge Function "example" is referencing unsupported modules:
	- __vc__ns__/0/build/server/edge-abcde/index.js: remix-utils/client-only

ClientOnly does not import from node, it only imports from react:

https://github.com/sergiodxa/remix-utils/blob/main/src/react/client-only.tsx
https://github.com/sergiodxa/remix-utils/blob/main/src/react/use-hydrated.ts

So this component should be usable on Vercel Edge and this seems to be a false positive.

Is the vercel pipeline flagging this due to the peer dependencies of remix-utils containing @remix-run/node?

https://github.com/sergiodxa/remix-utils/blob/main/package.json

How can I deploy a route using remix-utils to the edge?


Reproduction:

https://github.com/penx/remix-utils-vercel-edge

@TooTallNate
Copy link
Member

Thank you for the reproduction. We are investigating a fix for this.

@TooTallNate
Copy link
Member

@penx Can you please try again and let me know if the issue is fixed for you?

@penx
Copy link
Author

penx commented Apr 18, 2024

@TooTallNate unfortunately not, using remix-utils 7.6.0 and @vercel/remix 2.8.1

Screenshot 2024-04-18 at 16 24 06

@TooTallNate
Copy link
Member

Apologies. We had to roll back the flag for the change that was fixing this issue. If you want to test, set the environment variable VERCEL_EDGE_FUNCTIONS_ENHANCED_RESOLVE=1.

@penx
Copy link
Author

penx commented May 23, 2024

@TooTallNate do you know if enhanced resolve is still planned to be rolled out?

@TooTallNate
Copy link
Member

TooTallNate commented May 23, 2024

It is still planned, but some other tasks have taken priority so far. We will get to it soon. Is setting that environment variable working for you in the meantime?

@penx
Copy link
Author

penx commented Jun 10, 2024

@TooTallNate sorry for the delay in getting back, VERCEL_EDGE_FUNCTIONS_ENHANCED_RESOLVE=1 seems to help but when this is enabled we sometimes get an error post-build and pre-deploy so haven't been able to enable this permanently

sandbox.js:422:6610: ERROR: [plugin: vc:file-system] Expected "fakePath" to be defined

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

No branches or pull requests

2 participants