Unable to bind durable objects on Remix + Vite project

Hello, I'm trying to incorporate a durable object into my project that I have recently moved to Vite (from the classic Remix compiler). However I think this issue may be more relevant to Wrangler due to the nature of the error. I'm on MacOS and using Node 21.6.2. When running wrangler types (which in turn runs my Vite build process):
% npx wrangler types

⛅️ wrangler 3.63.1
-------------------

Running custom build: npm run build

> remix vite:build

Using vars defined in .dev.vars
service core:user:__WRANGLER_EXTERNAL_DURABLE_OBJECTS_WORKER: Worker "core:user:__WRANGLER_EXTERNAL_DURABLE_OBJECTS_WORKER"'s binding "BasicDurableObject" refers to a service "core:user:worker", but no such service is defined.
MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
at #assembleAndUpdateConfig (/Users/shay/Documents/GitHub/project/packages/site/node_modules/miniflare/dist/src/index.js:9178:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Mutex.runWith (/Users/shay/Documents/GitHub/project/packages/site/node_modules/miniflare/dist/src/index.js:3521:16)
at async #waitForReady (/Users/shay/Documents/GitHub/project/packages/site/node_modules/miniflare/dist/src/index.js:9235:5)
at async Miniflare2._getProxyClient (/Users/shay/Documents/GitHub/project/packages/site/node_modules/miniflare/dist/src/index.js:9359:5)
at async Miniflare2.getBindings (/Users/shay/Documents/GitHub/project/packages/site/node_modules/miniflare/dist/src/index.js:9378:25)
at async getPlatformProxy (/Users/shay/Documents/GitHub/project/packages/site/node_modules/wrangler/wrangler-dist/cli.js:210460:20)
at async configureServer (/Users/shay/Documents/GitHub/project/packages/site/node_modules/@remix-run/dev/dist/vite/cloudflare-proxy-plugin.js:55:11)
at async _createServer (file:///Users/shay/Documents/GitHub/project/node_modules/vite/dist/node/chunks/dep-CzJTQ5q7.js:63370:20)
at async configResolved (/Users/shay/Documents/GitHub/project/packages/site/node_modules/@remix-run/dev/dist/vite/plugin.js:750:27) {
code: 'ERR_RUNTIME_FAILURE',
cause: undefined
}
npm ERR! Lifecycle script `build` failed with error:
npm ERR! Error: command failed
npm ERR! in workspace: [email protected]
npm ERR! at location: /Users/shay/Documents/GitHub/project/packages/site

✘ [ERROR] Running custom build `npm run build` failed. There are likely more logs from your build command above.
% npx wrangler types

⛅️ wrangler 3.63.1
-------------------

Running custom build: npm run build

> remix vite:build

Using vars defined in .dev.vars
service core:user:__WRANGLER_EXTERNAL_DURABLE_OBJECTS_WORKER: Worker "core:user:__WRANGLER_EXTERNAL_DURABLE_OBJECTS_WORKER"'s binding "BasicDurableObject" refers to a service "core:user:worker", but no such service is defined.
MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
at #assembleAndUpdateConfig (/Users/shay/Documents/GitHub/project/packages/site/node_modules/miniflare/dist/src/index.js:9178:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Mutex.runWith (/Users/shay/Documents/GitHub/project/packages/site/node_modules/miniflare/dist/src/index.js:3521:16)
at async #waitForReady (/Users/shay/Documents/GitHub/project/packages/site/node_modules/miniflare/dist/src/index.js:9235:5)
at async Miniflare2._getProxyClient (/Users/shay/Documents/GitHub/project/packages/site/node_modules/miniflare/dist/src/index.js:9359:5)
at async Miniflare2.getBindings (/Users/shay/Documents/GitHub/project/packages/site/node_modules/miniflare/dist/src/index.js:9378:25)
at async getPlatformProxy (/Users/shay/Documents/GitHub/project/packages/site/node_modules/wrangler/wrangler-dist/cli.js:210460:20)
at async configureServer (/Users/shay/Documents/GitHub/project/packages/site/node_modules/@remix-run/dev/dist/vite/cloudflare-proxy-plugin.js:55:11)
at async _createServer (file:///Users/shay/Documents/GitHub/project/node_modules/vite/dist/node/chunks/dep-CzJTQ5q7.js:63370:20)
at async configResolved (/Users/shay/Documents/GitHub/project/packages/site/node_modules/@remix-run/dev/dist/vite/plugin.js:750:27) {
code: 'ERR_RUNTIME_FAILURE',
cause: undefined
}
npm ERR! Lifecycle script `build` failed with error:
npm ERR! Error: command failed
npm ERR! in workspace: [email protected]
npm ERR! at location: /Users/shay/Documents/GitHub/project/packages/site

✘ [ERROR] Running custom build `npm run build` failed. There are likely more logs from your build command above.
service core:user:__WRANGLER_EXTERNAL_DURABLE_OBJECTS_WORKER: Worker "core:user:__WRANGLER_EXTERNAL_DURABLE_OBJECTS_WORKER"'s binding "BasicDurableObject" refers to a service "core:user:worker", but no such service is defined.
Am I defining my binding incorrectly? I don't really understand what to do with this information and I couldn't find anything online. My object, which is exported from my main file:
export class BasicDurableObject extends DurableObject {
constructor(state, env) {
super();
}

async fetch(request) {
return new Response(undefined, { status: 204 });
}
}
export class BasicDurableObject extends DurableObject {
constructor(state, env) {
super();
}

async fetch(request) {
return new Response(undefined, { status: 204 });
}
}
binding:
[[durable_objects.bindings]]
name = "BASIC_DO"
class_name = "BasicDurableObject"
[[durable_objects.bindings]]
name = "BASIC_DO"
class_name = "BasicDurableObject"
3 Replies
lifeiscontent
lifeiscontent3mo ago
@shay did you ever figure this out?
shay
shayOP3mo ago
No, I ended up shelving this and staying on the classic app server :( sorry
jasonj
jasonj2w ago
in remix+vite+workers , it could be work export class WSWorker implements DurableObject { constructor(state, env) { } async fetch(request) { return new Response(undefined, { status: 204 }); } } and in local develop, can not use remix vite:dev to run it .
use build and wrangler dev to run it in local to debug this part
Want results from more Discord servers?
Add your server