withastro / adapters

Home for Astro's core maintained adapters
49 stars 26 forks source link

Run Dev Not Working with Cloudflare adapter #322

Open Xeffen25 opened 2 weeks ago

Xeffen25 commented 2 weeks ago

Astro Info

Astro                    v4.11.5
Node                     v20.15.0
System                   Windows (x64)
Package Manager          npm
Output                   server
Adapter                  @astrojs/cloudflare
Integrations             none

Describe the Bug

I initialize an astro project with: npm create astro@latest

And add the Cloudflare adapter: npx astro add cloudflare

Finaly run: npm run dev

Results in the following error: *** Received structured exception #0xc0000005: access violation; stack: 7ff89774301f 7ff62208337b 7ff622083443 7ff6220774bc 7ff622077467 7ff6218f7d5e 7ff6218f806f 7ff6207e1706 7ff6207e14ea 7ff621a6f97f 7ff621a76b36 7ff621a6fe9c 7ff621a76b36 7ff621a6d80c 7ff6207d1551 7ff623158bff 7ff8afb7257c 7ff8b07caf27 The Workers runtime failed to start. There is likely additional logging output above. Stack trace: at #assembleAndUpdateConfig (C:\it\test\node_modules\miniflare\dist\src\index.js:9178:13) at async Mutex.runWith (C:\it\test\node_modules\miniflare\dist\src\index.js:3521:16) at async Miniflare2._getProxyClient (C:\it\test\node_modules\miniflare\dist\src\index.js:9359:5) at async getPlatformProxy (C:\it\test\node_modules\wrangler\wrangler-dist\cli.js:210460:20) at async withTakingALongTimeMsg (file:///C:/it/test/node_modules/astro/dist/integrations/hooks.js:23:18)

I was using a node version manager Volta. Tried uninsalling and installing node manualy. Tried also using pnpm. Not found any Issue reported so created one. I think it has to do with the Workerd Runtime for development but I am unsure. As when deploying the project on Cloudflare it works. You can also not run the npm run preview it also gives an error.

I attempted to create a reproductible example but when starting from basic template in StackBlitz and just adding the Cloudflare Adapter it doesn't work but gives the following error instead: ❯ npm run dev

@example/basics@0.0.1 dev astro dev

04:01:54 [WARN] The currently selected adapter @astrojs/cloudflare is not compatible with the image service "Sharp". 04:01:54 [WARN] [config] The feature "astro:env getSecret" is experimental and subject to change (used by @astrojs/cloudflare). 04:01:54 [types] Added src/env.d.ts type declarations. 04:02:01 [build] Waiting for integration "@astrojs/cloudflare", hook "astro:server:setup"... /home/projects/qgnirbojgz.github/node_modules/@cloudflare/workerd-linux-64/bin/workerd: line 17: "foo(" must be followed by )

I have played around and by changing the adapter version to 10 in the packacge it allows to use npm run dev

What's the expected result?

The expected output is to be able to run a development server.

Link to Minimal Reproducible Example

unknown

Participation

alexanderniebuhr commented 2 weeks ago

@Xeffen25 I can't seem to reproduce the same behavior. Can you confirm that it happens with an empty Astro project?

alexanderniebuhr commented 2 weeks ago

related to https://github.com/cloudflare/workers-sdk/issues/6170

Xeffen25 commented 2 weeks ago

@alexanderniebuhr Yes it happens to me in any project I add the astro adaptar to. I can be empty or ave files but it still througs this error at me when trying to run it localy when using the cloudflare adapter at version 11 (any subversion too). I have a public repo called test if you might want to try it out I don't know if it might generate wrong. The only requirement is to have node right? or is there anthing I am missing for workerd?

alexanderniebuhr commented 2 weeks ago

I think workerd has a bug with Windows 11 right now, the linked issue I posted. They are working on a fix already.