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

[apollo-server-cloudflare] Worker deployment fails when using listen() #3838

Closed
maggo opened this issue Feb 28, 2020 · 1 comment
Closed

Comments

@maggo
Copy link

maggo commented Feb 28, 2020

apollo-server-cloudflare overrides the handy listen() method to set up addEventListener('fetch', …) but wrangler publish doesn't like this and fails with

Error: Something went wrong! Status: 400 Bad Request, Details {
  "result": null,
  "success": false,
  "errors": [
    {
      "code": 10021,
      "message": "No event handlers were registered. This script does nothing.\n"
    }
  ],
  "messages": []
}

I guess wrangler always requires a top-level addEventListener that is not registered in an async function.

I was able to fix this by implementing my own top-level event handler and copying the code from listen()

Example

https://github.com/maggo/apollo-cloudflare-issue

Clone, yarn, add account_id in wrangler.toml and wrangler publish. You'll receive the same error

@glasser
Copy link
Member

glasser commented Oct 20, 2022

As of Apollo Server 4, we maintain a stable API for building web framework integrations instead of a specific integration with CloudFlare Workers (which, let's be honest, was an experimental integration that one person wrote over the weekend 4.5 years ago and we never touched again — it's impressive that it worked as well as it did for anyone!). We hope to see CloudFlare Workers users build and maintain an integration against our new API!

@glasser glasser closed this as completed Oct 20, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants