lambda-packages icon indicating copy to clipboard operation
lambda-packages copied to clipboard

Vercel Edge Adapter fails to deploy with Sanity integration enabled

Open webcicle opened this issue 3 years ago • 3 comments

What version of astro are you using?

^1.1.1

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

Vercel

What package manager are you using?

npm

What operating system are you using?

Mac

Describe the Bug

When activating SSR via Vercel edge, the build gives the following error

[commonjs--resolver] Cannot bundle Node.js built-in "url" imported from "node_modules/eventsource/lib/eventsource.js". Consider disabling ssr.noExternal or remove the built-in dependency.
--
15:43:31.768 | file: /vercel/path0/node_modules/@sanity/client/lib/sanityClient.js
15:43:32.007 | error   Cannot bundle Node.js built-in "url" imported from "node_modules/eventsource/lib/eventsource.js". Consider disabling ssr.noExternal or remove the built-in dependency.

If I change it to a serverless function the deploy works. This issue is similar to #4391 but appears to be related to Sanity.io integration.

Here is my astro.config setup as well:

import { defineConfig } from 'astro/config';
import vercel from '@astrojs/vercel/serverless';

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

The stackblitz link does not contain a reproducible example but steps to reproduce would be:

  • Setup project and Sanity.io client, connected to CMS
  • Add a fetch request from DB
  • Deploy to Vercel with Edge adapter

Link to Minimal Reproducible Example

https://stackblitz.com/github/withastro/astro/tree/latest/examples/minimal?file=src/pages/index.astro

Participation

  • [ ] I am willing to submit a pull request for this issue.

webcicle avatar Sep 05 '22 15:09 webcicle