-
Notifications
You must be signed in to change notification settings - Fork 916
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
App Hosting JS SDK autoinit #8483
Conversation
🦋 Changeset detectedLatest commit: 939af36 The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Size Report 1Affected Products
Test Logs |
Size Analysis Report 1Affected Products
Test Logs |
cc7a691
to
2c6344c
Compare
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.
Some nits and questions, but approved overall.
packages/util/postinstall.js
Outdated
.then(getFullConfig) | ||
.catch(handleUnexpectedError) | ||
.then(async config => { | ||
const emulatorHosts = { |
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.
Clarification: does this execute if partialConfig is undefined (and subsequently fullConfig)?
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.
It does, the idea is to wipe out any hardcoded config from prior runs. The Firebase CLI will trip this script during either a Hosting deploy or emulator start.
Adds a
postinstall
step to@firebase/util
which hardcodes autoinit defaults into@firebase/util/dist/postinstall.(m)js
for both CJS and ESM variants go/firestack-autoinit.Hardcoding is important since environment variable substitution doesn't dive into a developer's
node_modules
folder. This gives us a framework agnostic way to inject configuration and is a more robust solution than the experimental autoinit methods provided by Web Frameworks go/firebase-api-client-autoinit. Once this lands, we'll backport to Hosting and Functions and aim to deprecate the other autoinit methods.I know
postinstall.js
is verbose but wanted to ensure it is compatible with the Node >= 18, has robust messaging, and fails open—e.g, overridespostinstall.(m)js
such that it disables autoinit on failure.