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
Vite Bundle Error for new Astro Actions in Astro v4.8 (cannot bundle node:async_hooks) #11005
Comments
Hey @rhymbit! I see you're using the Cloudflare adapter here. You'll need to add the nodejs_compat compatibility flag to use actions. We use the 'async local storage' feature to help you access API context (headers, cookies, etc) from your actions. Is this possible, or will this have drawbacks for you? |
@bholmesdev adapter: cloudflare({
platformProxy: {
enabled: true,
configPath: "wrangler.toml",
},
}), I've also pushed these changes to the project's repository so you can check them out. But it still fails to build with the exact same error. Is it not possible for me to build this project locally on my PC, and will it only build inside the Cloudflare dashboard? Please let me know if there's any other way to build a project locally that uses Actions in it, but for now I suppose I'll just simply use endpoints. |
Ah yep, looks like we missed one more step: you'll need to mark the node dependency as "external" in your astro config. The Let me know if that resolves the issue! |
@bholmesdev |
I'm running into the same issue. I've tried copying @rhymbit astro config and wrangler.toml files like-for-like but I keep getting build errors on cloudflare:
heres my repo : https://github.com/chiubaca/fullstack-astro-cloudflare |
Hey @chiubaca! Sorry to hear that. Taking a peak at the source code, it looks like your compatibility_flags = [ "nodejs_compat" ] Have you tried setting this? |
Thanks for the response @bholmesdev . The issues was indeed my wrangler.toml. These settings are have fixed the issue for me
|
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
I created a astro starter project repo that shows this problem. Please checkout the README, also clone and try to build the project.
https://github.com/rhymbit/astro-actions-bundle-bug
Vite is unable to bundle
node:async_hooks
module which is used in a file (store.js
) by the new "Astro Actions" feature.I'm using
pnpm
and this is the file that uses it :-node_modules/.pnpm/[email protected][email protected]/node_modules/astro/dist/actions/runtime/store.js
What's the expected result?
Expected result will be that
pnpm build
builds the project successfully.There were 0 errors with
astro check
, but the build still fails becasuse vite cannot bundle thisnode:async_hooks
module.Link to Minimal Reproducible Example
https://github.com/rhymbit/astro-actions-bundle-bug
Participation
The text was updated successfully, but these errors were encountered: