-
Notifications
You must be signed in to change notification settings - Fork 734
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
Comments
The error message is coming from the API? I don't see code in Wrangler 2 that would produce that error message. |
@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 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. |
Thanks for the update @mhart. I agree we could do better here. |
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.
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.
@koeninger can your team take a look at this? |
We can change the API to fix this error message, but I believe @mhart's suggestion would be a good solution |
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. |
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)The text was updated successfully, but these errors were encountered: