Skip to content

vite plugin with named entrypoints does not work #9758

Open
@osseonews

Description

@osseonews

When trying to run RPC locally with the React + Vite framework (https://developers.cloudflare.com/workers/framework-guides/web-apps/react/) with a Service Binding with named entrypoints, you get the error below. The RPC works fine once you publish and deploy the worker, but on local dev using vite , it throws the error below. This requires us to comment out the RPC code in local dev or else we can't run the application. We are familiar with RPC and can run it locally with regular workers, so we have done this before. This error only occurs when trying to use vite with the cloudflare plugin locally. So I think this is a bug in the cloudflare plugin for Vite because it doesn't work with RPC.

error when starting dev server:
AssertionError [ERR_ASSERTION]: does not match a worker name.
at getWorkerToWorkerEntrypointNamesMap (node_modules/@cloudflare/vite-plugin/dist/index.js:13386:9)
at getDevMiniflareOptions (node_modules/@cloudflare/vite-plugin/dist/index.js:13624:44)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async configureServer (node_modules/@cloudflare/vite-plugin/dist/index.js:14522:37)
at async _createServer (node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:38657:20)
at async CAC. (fnode_modules/vite/dist/node/cli.js:753:20)

BTW our binding in the wrangler.jsonc looks like this (names changed). It works perfectly fine in production, just doesn't work in local development. The service bindings just don't get picked up. Our set up is exactly the same as what you get when you run the CLI from the link above for React + vite framework

"services": [
	{
			"binding": "OUR_SERVICE",
			"service": "our_worker_service_name",
			"entrypoint": "ENTRY_CLASS"
		}
	],

Metadata

Metadata

Assignees

Labels

bugSomething that isn't workingvite-pluginRelating to the `@cloudflare/vite-plugin` package

Type

No type

Projects

Status

Untriaged

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions