-
Notifications
You must be signed in to change notification settings - Fork 707
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
fix: add better error for user binding called ASSETS in pages projects #7141
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"wrangler": patch | ||
--- | ||
|
||
fix: throw a better error if there is an "ASSETS" user binding in a Pages projects |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -2773,6 +2773,12 @@ const validateBindingsHaveUniqueNames = ( | |||||
bindingsGroupedByName[bindingName] = []; | ||||||
} | ||||||
|
||||||
if (bindingName === "ASSETS" && isPagesConfig(config)) { | ||||||
diagnostics.errors.push( | ||||||
`The name 'ASSETS' is reserved in Pages projects. Please use a different name for your ${bindingType} binding.` | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Is binding name case sensitive? Might be better to show the original name user provided.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. turns out it is case sensitive, so you totally can deploy with 'assets' (lowercase) no issues |
||||||
); | ||||||
} | ||||||
|
||||||
bindingsGroupedByName[bindingName].push(bindingType); | ||||||
} | ||||||
} | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided it was okay to just shove the check in here as a one-off, because I don't think we have any other reserved binding names (correct me if i'm wrong though) and we should absolutely not introduce any new binding names that could conflict like this either.