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

Improve error message when given invalid hosting configuration. #5533

Merged
merged 4 commits into from
Feb 18, 2023

Conversation

taeold
Copy link
Contributor

@taeold taeold commented Feb 17, 2023

Given invalid hosting configuration, Firebase CLI fails in an unhelpful way.

e.g.

{
  "hosting": {
    "public": "public",
    "rewrites": [
      {
        // missing "destination", "function", or "run"
        "source": "**"
      }
    ]
  }
}

Before:

$ firebase deploy --only hosting
...
Error: An unexpected error has occurred.

$ firebase deploy --only hosting --debug
...
Error: Never has a value ([object Object]). This should be impossible

After

$ firebase deploy --only hosting
...
Error: Invalid hosting rewrite config in firebase.json. A rewrite config must specify 'destination', 'function', 'dynamicLinks', or 'run'

Fixes https://groups.google.com/a/google.com/g/firebase-discuss/c/VoQ0XkNnZFs

@taeold taeold enabled auto-merge (squash) February 17, 2023 22:02
@taeold taeold disabled auto-merge February 17, 2023 22:04
} catch (e: any) {
throw new FirebaseError(
"Invalid hosting rewrite config in firebase.json. " +
"A rewrite config must specify 'destination', 'function', 'dynamicLinks', or 'run'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the only list of situations where this can happen? If so, then this should bef ine

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!

@codecov-commenter
Copy link

codecov-commenter commented Feb 17, 2023

Codecov Report

Base: 56.13% // Head: 56.13% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (220cbfc) compared to base (d6826ee).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5533   +/-   ##
=======================================
  Coverage   56.13%   56.13%           
=======================================
  Files         317      317           
  Lines       21503    21505    +2     
  Branches     4388     4388           
=======================================
+ Hits        12070    12072    +2     
- Misses       8370     8371    +1     
+ Partials     1063     1062    -1     
Impacted Files Coverage Δ
src/deploy/hosting/convertConfig.ts 72.41% <0.00%> (-1.28%) ⬇️
src/functional.ts 91.48% <0.00%> (ø)
src/emulator/auth/state.ts 85.43% <0.00%> (+0.56%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@taeold taeold merged commit 05f4f50 into master Feb 18, 2023
@taeold taeold deleted the dl-nothings-impossible branch February 18, 2023 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants