#Cannot read properties of undefined (reading 'bind')

4 messages · Page 1 of 1 (latest)

kindred knoll
#

<@&1095491216776380548> using cloudflare adapter I just migrated from Astro 5 to Astro 6 any idea on why I'm getting this when starting the dev server:

[ERROR] [vite] Internal server error: Cannot read properties of undefined (reading 'bind')
      at runInRunnerObject (workers/runner-worker/index.js:106:3)
      at _NonRunnablePipeline.getComponentByRoute ([MASKED]/node_modules/.vite/deps_ssr/astro_app_entrypoint_dev.js?v=70d58831:196:20)
      at matchRoute ([MASKED]/node_modules/.vite/deps_ssr/astro_app_entrypoint_dev.js?v=70d58831:266:14)
      at DevApp.devMatch ([MASKED]/node_modules/.vite/deps_ssr/astro_app_entrypoint_dev.js?v=70d58831:377:26)
      at Object.handle [as fetch] ([MASKED]/node_modules/.vite/deps_ssr/@astrojs_cloudflare_entrypoints_server.js?v=70d58831:160:20)
      at maybeCaptureError (workers/runner-worker/index.js:50:10)
tough currentBOT
#

Hi @kindred knoll. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

The knowledge sources don't contain specific information about this exact error (Cannot read properties of undefined (reading 'bind')), so I can't pinpoint the root cause with certainty.

However, since you just migrated from Astro 5 to Astro 6 with the Cloudflare adapter, there are several breaking changes that could be contributing. Here are the most likely things to check:

1. Update your Wrangler entrypoint

The main field in your Wrangler config must now point to the new unified entrypoint: [Wrangler entrypoint]

// wrangler.jsonc
{
  "main": "@astrojs/cloudflare/entrypoints/server",
  "name": "my-astro-app",
  // ... rest of config
}

2. Remove workerEntryPoint if you were using it

If you had a custom workerEntryPoint in your adapter config, it has been removed. You now specify the entrypoint in wrangler.jsonc and use standard Cloudflare Worker syntax. [Custom entrypoint API]

3. CommonJS compatibility issues

The new workerd environment does not support CommonJS syntax (require, module.exports). Some of your dependencies may be throwing errors as a result. [Cloudflare upgrade guide]

If a dependency uses CommonJS, you can pre-compile it via optimizeDeps.include in a Vite plugin.

4. Ensure you're on @astrojs/cloudflare v13+

Astro 6 requires @astrojs/cloudflare v13 or later. Make sure your adapter is fully upgraded. [Cloudflare adapter]

#

I'd recommend starting with the Wrangler entrypoint change, as the error stack trace references @astrojs_cloudflare_entrypoints_server.js, which suggests the new entrypoint is being used but may not be configured correctly.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: