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: service should be an optional field under [[services]] #7949

Open
threepointone opened this issue Jan 28, 2025 · 0 comments
Open
Labels
bug Something that isn't working

Comments

@threepointone
Copy link
Contributor

Which Cloudflare product(s) does this pertain to?

Wrangler

What versions are you using?

3.106.0

What operating system and version are you using?

MacOS

Please provide a link to a minimal reproduction

No response

Describe the Bug

AKA we should support self defined WorkerEntrypoint better.

Consider this worker

// ./src/server.ts
import { WorkerEntrypoint } from "cloudflare:workers";

export class MyWorker extends WorkerEntrypoint {
  someMethod() {
    return "hello " + Math.random();
  }
}

export default {
  async fetch(request: Request, env: Env, ctx: ExecutionContext) {
    return Response.json(await env.MyWorker.someMethod());
  }
}

with this wrangler.toml:

name = "example-worker"
main = "src/server.ts"
compatibility_date = "2025-01-28"

[[services]]
binding = "MyWorker"
service = "example-worker" # this shouldn't be necessary
entrypoint = "MyWorker"

2 problems here:

  • service = "example-worker" shouldn't be ncessary since it's in the same worker. it should default to the main worker. but removing that line causes validation to fail.
  • when running wrangler dev, I get this output
Image

That seems wrong, since it connects to itself successfully. Thankfully the worker still functions.

Please provide any relevant error logs

No response

@threepointone threepointone added the bug Something that isn't working label Jan 28, 2025
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Jan 28, 2025
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
Status: Untriaged
Development

No branches or pull requests

1 participant