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

Vercel Edge Adapter fails to deploy if react integration is enabled #4391

Closed
1 task
janus-reith opened this issue Aug 19, 2022 · 3 comments · Fixed by #4421 or #4667
Closed
1 task

Vercel Edge Adapter fails to deploy if react integration is enabled #4391

janus-reith opened this issue Aug 19, 2022 · 3 comments · Fixed by #4421 or #4667
Assignees
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)

Comments

@janus-reith
Copy link

What version of astro are you using?

1.0.6

Are you using an SSR adapter? If so, which one?

Vercel

What package manager are you using?

pnpm

What operating system are you using?

Mac

Describe the Bug

Using the following astro config:

import { defineConfig } from "astro/config";
import react from "@astrojs/react";
import vercel from "@astrojs/vercel/edge";

export default defineConfig({
  integrations: [react()],
  output: "server",
  adapter: vercel(),
});

Deployment on Vercel fails with:
commonjs--resolver] Cannot bundle Node.js built-in "stream" imported from "node_modules/.pnpm/react-dom@18.2.0_react@18.2.0/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.min.js". Consider disabling ssr.noExternal or remove the built-in dependency.

Deployment succeeds when I disable the React integration or switch to @astrojs/vercel/serverless

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-napk2o

Participation

  • I am willing to submit a pull request for this issue.
@FredKSchott
Copy link
Member

I'm not sure why https://unpkg.com/browse/react-dom@18.2.0/cjs/react-dom-server-legacy.node.production.min.js is being loaded, https://unpkg.com/browse/react-dom@18.2.0/cjs/react-dom-server.node.production.min.js doesn't have this dependency on stream and should work fine. I don't know how this package works internally though, so more investigation needed to find out why the legacy file is being used. I can reproduce on stackblitz.

@FredKSchott FredKSchott added the - P4: important Violate documented behavior or significantly impacts performance (priority) label Aug 21, 2022
@janus-reith
Copy link
Author

janus-reith commented Aug 23, 2022

@bholmesdev I tried @astrojs/vercel v1.0.1 and while the build succeeds now, pages that use a react component are rendered with an empty body.
I have added a second page similar to the other one, except that the React component has been omitted, that one renders fine.

@bholmesdev
Copy link
Contributor

Ah, fair enough! I'll re-open this issue so we don't have to refile a separate one. Will investigate 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)
Projects
None yet
3 participants