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

🐛 BUG: ERR_IPC_CHANNEL_CLOSED when saving Pages Function with local D1 binding #4017

Closed
scruffymongrel opened this issue Sep 23, 2023 · 7 comments · Fixed by #4054
Closed
Labels
bug Something that isn't working

Comments

@scruffymongrel
Copy link

scruffymongrel commented Sep 23, 2023

Which Cloudflare product(s) does this pertain to?

D1, Pages, Wrangler core

What version(s) of the tool(s) are you using?

3.9.0 [Wrangler]

What version of Node are you using?

20.7.0

What operating system are you using?

Mac

Describe the Bug

When running pnpm wrangler pages dev ./public via wrangler 3.9.0, changes to a Pages Function work fine if there is no local D1 binding.

Once a local D1 binding is created via pnpm wrangler pages dev ./public --d1=DB (as per https://developers.cloudflare.com/pages/platform/functions/bindings/#d1-databases), changes to the Pages Function cause wrangler to crash.

Before restarting wrangler, I need to lsof -I :8788 and kill -9 the process, otherwise I get ✘ [ERROR] MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.

Please provide a link to a minimal reproduction

https://github.com/Hinte-land/repro-wrangler-3.9.0-pages-d1-local

Please provide any relevant error logs

/Users/andy/§/github.com/hinte-land/repro-wrangler-3.9.0-pages-d1-local/node_modules/.pnpm/wrangler@3.9.0/node_modules/wrangler/wrangler-dist/cli.js:30947
            throw a;
            ^

Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed
    at new NodeError (node:internal/errors:405:5)
    at target.send (node:internal/child_process:754:16)
    at Object.announceAndOnReady [as onReady] (/Users/andy/§/github.com/hinte-land/repro-wrangler-3.9.0-pages-d1-local/node_modules/.pnpm/wrangler@3.9.0/node_modules/wrangler/wrangler-dist/cli.js:150032:15)
    at MiniflareServer.<anonymous> (/Users/andy/§/github.com/hinte-land/repro-wrangler-3.9.0-pages-d1-local/node_modules/.pnpm/wrangler@3.9.0/node_modules/wrangler/wrangler-dist/cli.js:128172:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Emitted 'error' event on process instance at:
    at process.processEmit [as emit] (/Users/andy/§/github.com/hinte-land/repro-wrangler-3.9.0-pages-d1-local/node_modules/.pnpm/wrangler@3.9.0/node_modules/wrangler/wrangler-dist/cli.js:25324:38)
    at node:internal/child_process:758:35
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11) {
  code: 'ERR_IPC_CHANNEL_CLOSED'
}

Node.js v20.7.0
@scruffymongrel scruffymongrel added the bug Something that isn't working label Sep 23, 2023
@Sylphritz
Copy link

Sylphritz commented Sep 24, 2023

I'm getting the same error via the following command:

wrangler pages dev --compatibility-date=2023-09-19 --d1=DB --proxy 3000 -- pnpm dev

For context, I'm running a Nuxt app via Pages proxy.

@Phoenixmatrix
Copy link

even without the d1 binding I get the issue in wrangler 3.9. I have a Remix app and if I make any change that affects the server (so update the pages function), it will cause the error. That's with a brand new app, no binding, nothing.

Reverting to 3.7 fixes the issue (I think 3.8 was fine too, but didn't double check). If I upgrade back to 3.9, issue returns.

@aaronadamsCA
Copy link

+1 to having this issue with no bindings. Our command is

wrangler pages dev public/ --compatibility-date=2023-08-01 --local-protocol=https --port=8002

and we get a crash upon saving any file.

Reverting to Wrangler v3.8.0 works.

@Sylphritz
Copy link

Sylphritz commented Sep 27, 2023

I updated wrangler to 3.10.0 and the problem is gone.

EDIT: Never mind, it crashes again when I change something in the functions. However, I can confirm that reverting back to 3.8.0 works.

@scruffymongrel
Copy link
Author

Can confirm same behaviour under 3.10.0.

From what I've seen, reverting back to 3.8.0 seems to need something like cf-bindings-proxy to enable local D1 with Pages. I've managed to get a workable solution with 3.8.0 and cf-bindings-proxy but am keen to remove the extra dependency if possible.

@kreas
Copy link

kreas commented Sep 28, 2023

Can confirm. Same issue for me as well

➜  ai-cf git:(main) ✗ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:        22.04
Codename:       jammy
➜  ai-cf git:(main) ✗ node -v
v20.6.1

@TEMHITHORPHE
Copy link

seems related to this issue here #4008 ... there's a workaround mentioned there, but the straightforward thing seems to downgrade back down to Wrangler 3.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants