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

Using Astro Actions causes Build Error #11354

Open
1 task
hkbertoson opened this issue Jun 26, 2024 · 4 comments
Open
1 task

Using Astro Actions causes Build Error #11354

hkbertoson opened this issue Jun 26, 2024 · 4 comments
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)

Comments

@hkbertoson
Copy link

Astro Info

Astro                    v4.11.3
Node                     v20.15.0
System                   macOS (arm64)
Package Manager          pnpm
Output                   hybrid
Adapter                  @astrojs/cloudflare
Integrations             @astrojs/tailwind
                         astro-icon
                         @astrojs/react

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When actions are enabled. Project does not build

What's the expected result?

Project should build

Link to Minimal Reproducible Example

https://stackblitz.com/edit/withastro-astro-tpp1b5

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Jun 26, 2024
@alexanderniebuhr
Copy link
Member

Issue happens with Cloudflare & Node.. So no adapter specific issue.

@ematipico ematipico added - P3: minor bug An edge case that only affects very specific usage (priority) and removed needs triage Issue needs to be triaged labels Jun 26, 2024
@ematipico
Copy link
Member

cc @bholmesdev

@bholmesdev
Copy link
Contributor

Hi @hkbertoson, thanks for reporting! I see you're using the Cloudflare adapter. Did you try the following?

  1. Add the nodejs_als flag to your wrangler config. This allows a Node-specific API that actions relies on
# wrangler.toml
compatibility_flags = [ "nodejs_als" ]
  1. Mark this Node API as external in your vite config:
import {defineConfig} from "astro/config";
import cloudflare from '@astrojs/cloudflare';

export default defineConfig({
  adapter: cloudflare({}),
  output: 'server',
  vite: {
    ssr: {
      external: ['node:async_hooks'],
    },
  },
})

I was also unable to reproduce this bug with the node adapter as @alexanderniebuhr noted above. If you can share a minimal reproduction with the node adapter that displays this issue, please share!

@alexanderniebuhr
Copy link
Member

alexanderniebuhr commented Jun 27, 2024

@bholmesdev I just took that assumption based on screenshots from here https://discord.com/channels/830184174198718474/1255555330646216785

That thread shows that the Cloudflare specific issue can be fixed with the solution you posted but that then the same error as node appears. I think it might be an issue on how it is used in this specific case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

No branches or pull requests

4 participants