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

Conflict with Cloudfare D1 beta and durable objects #846

Open
danthegoodman1 opened this issue Jan 28, 2023 · 1 comment
Open

Conflict with Cloudfare D1 beta and durable objects #846

danthegoodman1 opened this issue Jan 28, 2023 · 1 comment

Comments

@danthegoodman1
Copy link

When using cloudflare in a worker that is bound to a durable object that also has d1 bound, I get the following:

Trace: TypeError: Fetch API cannot load: /get/rows
    at d1-beta-facade.entry.js:1529:16
    at Hono.dispatch (d1-beta-facade.entry.js:1192:15)
    at Hono.fetch (d1-beta-facade.entry.js:1093:19)
    at Object.fetch (d1-beta-facade.entry.js:1744:28) {
  stack: TypeError: Fetch API cannot load: /get/rows
    at…at Object.fetch (d1-beta-facade.entry.js:1744:28),
  message: Fetch API cannot load: /get/rows
}
    at logConsoleMessage (/Users/dangoodman/code/UserMachines/node_modules/wrangler/wrangler-dist/cli.js:122443:25)
    at WebSocket2.<anonymous> (/Users/dangoodman/code/UserMachines/node_modules/wrangler/wrangler-dist/cli.js:122217:13)
    at WebSocket2.onMessage (/Users/dangoodman/code/UserMachines/node_modules/wrangler/wrangler-dist/cli.js:96544:22)
    at WebSocket2.emit (node:events:525:35)
    at Receiver2.receiverOnMessage (/Users/dangoodman/code/UserMachines/node_modules/wrangler/wrangler-dist/cli.js:97432:24)
    at Receiver2.emit (node:events:513:28)
    at Receiver2.dataMessage (/Users/dangoodman/code/UserMachines/node_modules/wrangler/wrangler-dist/cli.js:96096:18)
    at Receiver2.getData (/Users/dangoodman/code/UserMachines/node_modules/wrangler/wrangler-dist/cli.js:96038:21)
    at Receiver2.startLoop (/Users/dangoodman/code/UserMachines/node_modules/wrangler/wrangler-dist/cli.js:95815:26)
    at Receiver2._write (/Users/dangoodman/code/UserMachines/node_modules/wrangler/wrangler-dist/cli.js:95772:14)

If I use a route that does not communicate with a durable object (but the worker is still bound to d1) then there is no issue. It seems to be when ever I try to fetch from within a worker to a durable object while d1 is also bound.

Wrangler.toml looks like

name = "gateway"
main = "services/gateway/index.ts"
compatibility_date = "2023-01-26"

kv_namespaces = [
  { binding = "KV", id = "xxx", preview_id = "xxx" }
]

durable_objects.bindings = [
  {name = "QUEUE", class_name = "Queue"},
  {name = "STATE", class_name = "State"}
]

[[ d1_databases ]]
binding = "REGISTRY"
database_name = "testdb"
database_id = "xxx"
preview_database_id = xxx"
@danthegoodman1 danthegoodman1 changed the title Conflict with Cloudfare D1 beta Conflict with Cloudfare D1 beta and durable objects Jan 28, 2023
@danthegoodman1
Copy link
Author

danthegoodman1 commented Jan 28, 2023

This returns a 500, and the durable object fetch handler never fires hono was tried with both the durable object and the worker, as well as just the worker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant