CloudFlare adapter crashes when package.json is modified
Closed this issue · 0 comments
alexturpin commented
Astro Info
Astro v4.1.3
Node v20.10.0
System macOS (arm64)
Package Manager npm
Output server
Adapter @astrojs/cloudflare
Integrations @astrojs/react
Describe the Bug
When running an Astro server with the CloudFlare adapter and local runtime enabled, e.g.:
export default defineConfig({
output: "server",
adapter: cloudflare({
mode: "directory",
runtime: {
mode: "local",
}
)}
})
Changes to package.json cause the server to crash with this error:
20:14:51 Configuration file updated. Restarting...
20:14:51 [@astrojs/cloudflare] Cleaning up the local Cloudflare runtime.
20:14:51 [WARN] [@astrojs/cloudflare] The current configuration does not support image optimization. To allow your project to build with the original, unoptimized images, the image service has been automatically switched to the 'noop' option. See https://docs.astro.build/en/reference/configuration-reference/#imageservice
20:14:52 [ERROR] [UnhandledRejection] Astro detected an unhandled rejection. Here's the stack trace:
MiniflareCoreError [ERR_DISPOSED]: Cannot use disposed instance
at #checkDisposed (/Users/alexturpin/src/bettertax/node_modules/miniflare/dist/src/index.js:8982:13)
at #waitForReady (/Users/alexturpin/src/bettertax/node_modules/miniflare/dist/src/index.js:8943:24)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async LocalPagesRuntime.getBindings (file:///Users/alexturpin/src/bettertax/node_modules/@astrojs/cloudflare/dist/utils/local-runtime.js:69:9)
at async middleware (file:///Users/alexturpin/src/bettertax/node_modules/@astrojs/cloudflare/dist/index.js:64:42)
Hint:
Make sure your promises all have an `await` or a `.catch()` handler.
Error reference:
https://docs.astro.build/en/reference/errors/unhandled-rejection/
Stack trace:
at /Users/alexturpin/src/bettertax/node_modules/miniflare/dist/src/index.js:8982:13
[...] See full stack trace in the browser, or rerun with --verbose.
20:14:52 [ERROR] [UnhandledRejection] Astro detected an unhandled rejection. Here's the stack trace:
MiniflareCoreError [ERR_DISPOSED]: Cannot use disposed instance
at #checkDisposed (/Users/alexturpin/src/bettertax/node_modules/miniflare/dist/src/index.js:8982:13)
at #waitForReady (/Users/alexturpin/src/bettertax/node_modules/miniflare/dist/src/index.js:8943:24)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async LocalPagesRuntime.getBindings (file:///Users/alexturpin/src/bettertax/node_modules/@astrojs/cloudflare/dist/utils/local-runtime.js:69:9)
at async middleware (file:///Users/alexturpin/src/bettertax/node_modules/@astrojs/cloudflare/dist/index.js:64:42)
Hint:
Make sure your promises all have an `await` or a `.catch()` handler.
Error reference:
https://docs.astro.build/en/reference/errors/unhandled-rejection/
Stack trace:
at #checkDisposed (/Users/alexturpin/src/bettertax/node_modules/miniflare/dist/src/index.js:8982:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[...] See full stack trace in the browser, or rerun with --verbose.
At first I thought this was happening randomly, but once I realized it was package.json I can just insert empty new lines in it and it crashes the server every time.
What's the expected result?
Changing package.json should not crash the server.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-6dftoj?file=package.json
Participation
- I am willing to submit a pull request for this issue.