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

Have wrangler automatically suggest creating a migration on failed durable object publish #1076

Closed
threepointone opened this issue May 19, 2022 · 6 comments
Labels
bug Something that isn't working quick win Potentially easy/straightforward issue to tackle

Comments

@threepointone
Copy link
Contributor

When you try to publish a Worker with Durable Objects but you haven't specified [migration], the error message mentions using --new-class cli command, which we don't support (but wrangler 1.x did). We should make this experience better (either by implementing those commands, or with better messages)

@threepointone threepointone added enhancement New feature or request bug Something that isn't working labels May 19, 2022
@threepointone threepointone moved this to Untriaged in workers-sdk May 19, 2022
@petebacondarwin
Copy link
Contributor

The error message is coming from the API? I don't see code in Wrangler 2 that would produce that error message.
I don't think we should support those options in Wrangler 2.
So shall we create a ticket to fix the error message on the CF API?

@petebacondarwin petebacondarwin added blocked Blocked on other work internal Requires support from the Cloudflare Platform labels May 26, 2022
@petebacondarwin petebacondarwin moved this from Untriaged to Backlog in workers-sdk May 26, 2022
@mhart
Copy link
Contributor

mhart commented May 26, 2022

@petebacondarwin here's the full error message:

$ wrangler publish
 ⛅️ wrangler 2.0.5 
-------------------
▲ [WARNING] In wrangler.toml, you have configured [durable_objects] exported by this Worker (Counter), but no [migrations] for them. This may not work as expected until you add a [migrations] section to your wrangler.toml. Refer to https://developers.cloudflare.com/workers/learning/using-durable-objects/#durable-object-migrations-in-wranglertoml for more details.



✘ [ERROR] ✘ [ERROR] Received a bad response from the API

  
    Cannot create binding for class Counter because it is not currently configured to implement
    durable objects. Did you forget to apply a --new-class migration to it? [code: 10061]
  
    If you think this is a bug, please open an issue at:
    https://github.com/cloudflare/wrangler2/issues/new

Then trying wrangler publish --new-class Counter obviously just results in the usage output.

Personally I feel like wrangler should automatically handle this for the first migration (or at least offer to) – it can detect that one's needed after all. It points the user to documentation, but even that still doesn't really make particularly clear that you need a migration to create the object initially – it just describes how wrangler can manage migrations. The closest the documentation comes is to say "When you make changes to your list of Durable Objects classes, you must initiate a migration process"

Not too fussed though – just that there are some usability gaps in the DO experience right now – especially if starting from scratch using the web UI. You can create a worker, creating your DO object in JS, etc. But then to get the DO binding you're just told to download wrangler, with no extra guidance on what's needed to hook it up to your existing worker.

@petebacondarwin
Copy link
Contributor

Thanks for the update @mhart. I agree we could do better here.

@threepointone threepointone reopened this May 31, 2022
Repository owner moved this from Backlog to Done in workers-sdk May 31, 2022
Repository owner moved this from Done to In Progress in workers-sdk May 31, 2022
threepointone added a commit that referenced this issue May 31, 2022
This gives a slightly better message when migrations are missing for declared durable objcts. Specifically, it gives a copy-pastable section to add to wrangler.toml, and doesn't show the warning at all for invalid class names anymore.

Partially makes #1076 better.
threepointone added a commit that referenced this issue May 31, 2022
This gives a slightly better message when migrations are missing for declared durable objcts. Specifically, it gives a copy-pastable section to add to wrangler.toml, and doesn't show the warning at all for invalid class names anymore.

Partially makes #1076 better.
@petebacondarwin petebacondarwin moved this from In Progress to Selected for development in workers-sdk Jun 20, 2022
@lrapoport-cf lrapoport-cf moved this from Selected for Development to Backlog in workers-sdk Feb 6, 2023
@lrapoport-cf
Copy link
Contributor

@koeninger can your team take a look at this?

@lrapoport-cf lrapoport-cf moved this from Backlog to Other in workers-sdk Mar 13, 2023
@koeninger koeninger removed their assignment May 27, 2023
@jspspike jspspike changed the title publishing a Worker with a Durable Object suggest an action not possible with wrangler2 Have wrangler automatically suggest creating a migration on failed durable object publish Jun 26, 2023
@jspspike jspspike moved this from Other to Backlog in workers-sdk Jun 26, 2023
@jspspike
Copy link
Contributor

We can change the API to fix this error message, but I believe @mhart's suggestion would be a good solution

@lrapoport-cf lrapoport-cf added awaiting Cloudflare response Awaiting response from workers-sdk maintainer team and removed blocked Blocked on other work labels Jul 31, 2023
@mrbbot mrbbot added quick win Potentially easy/straightforward issue to tackle and removed awaiting Cloudflare response Awaiting response from workers-sdk maintainer team labels Jul 31, 2023
@lrapoport-cf lrapoport-cf removed internal Requires support from the Cloudflare Platform enhancement New feature or request labels Jul 31, 2023
@1000hz
Copy link
Contributor

1000hz commented Jan 10, 2024

Closing this as completed with @threepointone's commit in b817136, as well as opening new internal tickets to update our internal API error and docs to no longer recommend using these non-existent wrangler flags.

@1000hz 1000hz closed this as completed Jan 10, 2024
@github-project-automation github-project-automation bot moved this from Backlog to Done in workers-sdk Jan 10, 2024
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 quick win Potentially easy/straightforward issue to tackle
Projects
None yet
Development

No branches or pull requests

8 participants