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: Throw an actionable error if we detect a Pages project using Workers commands #6793

Closed
WalshyDev opened this issue Sep 20, 2024 · 0 comments · Fixed by #6996
Closed
Assignees
Labels
bug Something that isn't working error-messaging Improving user facing error messages pages Relating to Pages quick win Potentially easy/straightforward issue to tackle wrangler Relating to the Wrangler CLI tool

Comments

@WalshyDev
Copy link
Member

WalshyDev commented Sep 20, 2024

Which Cloudflare product(s) does this pertain to?

Wrangler

What version(s) of the tool(s) are you using?

v3.78.7

What version of Node are you using?

No response

What operating system and version are you using?

Macos 14.6.1 (23G93)

Describe the Bug

Observed behavior

When running commands such as wrangler secrets list or wrangler deploy we should be detecting if the project a user is in is a Pages project (has pages output dir in wrangler.toml) and throw an actionable error for the user pointing them to the command needed for Pages.
Currently, running these commands will do Worker actions and cause confusion for users.

For example, running wrangler secrets list currently outputs:

$ npx wrangler@latest secret list

✘ [ERROR] A request to the Cloudflare API (/accounts/4e599df4216133509abaac54b109a647/workers/scripts/pages-example/secrets) failed.

  This Worker does not exist on your account. [code: 10007]

  If you think this is a bug, please open an issue at:
  https://github.com/cloudflare/workers-sdk/issues/new/choose

which is very confusing for a user - they know the Pages Worker exists but it says it doesn't.

Instead, we should do an output like:

$ npx wrangler@latest secret list

✘ [ERROR] This command is for Workers, for Pages please run `wrangler pages secret list`

Another example is deploy where it'll error about main not being set - if a user sets that, they're now gonna deploy a Worker which will not be what they want and will not work like they expect. This should also link to wrangler pages deploy.


I think for non-wrangler.toml projects, we cannot nicely handle this today but we can at least improve it for those with the toml file.

Steps to reproduce

  • Create a Pages project with wrangler.toml
  • Attempt to do wrangler secret list

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

cc: @IgorMinar

@WalshyDev WalshyDev added bug Something that isn't working wrangler Relating to the Wrangler CLI tool labels Sep 20, 2024
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Oct 8, 2024
@emily-shen emily-shen moved this from Untriaged to Backlog in workers-sdk Oct 9, 2024
@emily-shen emily-shen added the quick win Potentially easy/straightforward issue to tackle label Oct 9, 2024
@lrapoport-cf lrapoport-cf added pages Relating to Pages error-messaging Improving user facing error messages labels Oct 14, 2024
@emily-shen emily-shen self-assigned this Oct 16, 2024
@github-project-automation github-project-automation bot moved this from Backlog to Done in workers-sdk Oct 17, 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 error-messaging Improving user facing error messages pages Relating to Pages quick win Potentially easy/straightforward issue to tackle wrangler Relating to the Wrangler CLI tool
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants