-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
🐛 BUG: deploying to netlify edge functions results in error #3420
Comments
Thanks for opening an issue! Are there any logs you can share that might give more insight into what is going on? |
This comment was marked as outdated.
This comment was marked as outdated.
I am reopening this because I'm still facing issues. The basic template was working fine but then I changed it to the
Repo: https://github.com/mayank99/astro-netlify-edge I have logs this time: Deploy logs from netlify
And the "Edge functions" tab has no logs. |
Hi! I'm part of the team that works on Netlify Edge Functions - I'll look into what's causing this, and if it's something on the Netlify side of things. |
The specific error message stems from Rust (see |
One way to provoke this exact error message is to run this snippet in a Deno REPL: import * as a from "data:application/javascript;base64,ZXhwb3J0IHsgYSB9IGZyb20gIi4vYS50cyI7Cg=="; This could be related to some Netlify-side bundling step. I'll continue looking into this after lunch. |
Even easier way to show this error message, in Deno, Chrome, Firefox, or Safari: new URL("./foo.js", "data:plain/text,xyz") All that is to say, something in either Astro or the Netlify build pipeline is emitting a data URL that contains a relative specifier. This is invalid. |
Could this also happen, when code contains |
Looking into this some more, the root cause are the dynamic imports: Deno Deploy and Netlify Edge Functions do not support dynamic imports. The error message is a bit of a red herring. @natemoo-re This can be resolved in Astro by using Vite's |
Thanks @lucacasonato, I was aware that Cloudflare Workers did not support dynamic imports but I wasn't aware that is the case for Deno Deploy. Is this something you're considering changing? I ask because fixing this on our end means using Rollup's |
@matthewp Yes, but this is unfortunately not a single toggle flag we can switch somewhere. It is a rather hard problem that we are trying to figure out a solution for. |
Plan is to bundle these in the adapter using esbuild. SvelteKit does this: sveltejs/kit#2963 |
Fixed in Deno Deploy but not Edge Functions, that's coming to another PR. |
Closed by #3535 being merged. |
@matthewp Thank you for releasing the fix. However, I'm getting a different error now on This is from the logs in "Edge functions" tab:
Worth noting that I'm still on I can create a new issue if this looks unrelated. |
This is likely a different issue. Deno doesn't define globalThis.process ||= {
env: Deno.env.toObject()
} |
What version of
astro
are you using?1.0.0-beta.31
Are you using an SSR adapter? If so, which one?
@astrojs/netlify/edge-functions
What package manager are you using?
npm
What operating system are you using?
Windows
Describe the Bug
I created a new astro repo with the portfolio template using
npm init astro -- --template portfolio
.Then I installed
@astrojs/[email protected]
and changed myastro.config.mjs
as follows:Then I pushed the changes to my repo. Netlify runs auto-deploy with its default settings. The site deploys "successfully" but results in
Error: TypeError: invalid URL: relative URL with a cannot-be-a-base base
as seen on https://new-astro-netlify-edge.netlify.app/See logs in my comment below.
Using the normal netlify functions adapter works perfectly fine.
Link to Minimal Reproducible Example
https://github.com/mayank99/astro-netlify-edge
Participation
The text was updated successfully, but these errors were encountered: