Skip to content

Add NEXT_PUBLIC prefix to FIREBASE#9830

Open
maneesht wants to merge 4 commits intomainfrom
mtewani/add-auto-init
Open

Add NEXT_PUBLIC prefix to FIREBASE#9830
maneesht wants to merge 4 commits intomainfrom
mtewani/add-auto-init

Conversation

@maneesht
Copy link
Copy Markdown
Contributor

  • Added NEXT_PUBLIC__FIREBASE_DEFAULTS__ to the auto-init allowlist

@maneesht maneesht requested a review from a team as a code owner April 10, 2026 17:14
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 10, 2026

🦋 Changeset detected

Latest commit: c17ec0b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
Name Type
@firebase/util Patch
@firebase/ai Patch
@firebase/analytics-compat Patch
@firebase/analytics Patch
@firebase/app-check-compat Patch
@firebase/app-check Patch
@firebase/app-compat Patch
@firebase/app Patch
@firebase/auth-compat Patch
@firebase/auth Patch
@firebase/component Patch
@firebase/data-connect Patch
@firebase/database-compat Patch
@firebase/database-types Patch
@firebase/database Patch
firebase Patch
@firebase/firestore-compat Patch
@firebase/firestore Patch
@firebase/functions-compat Patch
@firebase/functions Patch
@firebase/installations-compat Patch
@firebase/installations Patch
@firebase/messaging-compat Patch
@firebase/messaging Patch
@firebase/performance-compat Patch
@firebase/performance Patch
@firebase/remote-config-compat Patch
@firebase/remote-config Patch
@firebase/storage-compat Patch
@firebase/storage Patch

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

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for Next.js public environment variables as a fallback for Firebase defaults and introduces error logging. The review feedback highlights a naming inconsistency in the new environment variable and identifies redundant logging that should be consolidated to avoid duplicate console output.

I am having trouble creating individual review comments. Click here to see my feedback.

packages/util/src/defaults.ts (72-74)

medium

The variable name NEXT_PUBLIC__FIREBASE_DEFAULTS__ appears to be missing an underscore. The original variable is __FIREBASE_DEFAULTS__ (starting with two underscores). When prepending the Next.js NEXT_PUBLIC_ prefix, the resulting name should typically be NEXT_PUBLIC___FIREBASE_DEFAULTS__ (with three underscores) to maintain consistency with the original name and follow the standard prefixing pattern. Using only two underscores implies the prefix is being applied to _FIREBASE_DEFAULTS__.

  const defaultsJsonString =
    process.env.__FIREBASE_DEFAULTS__ ||
    process.env.NEXT_PUBLIC___FIREBASE_DEFAULTS__;

packages/util/src/defaults.ts (118-119)

medium

The error message is being logged twice, once with console.info and once with console.error. This is redundant and clutters the console output. If the intention is to make the error more visible, you should replace the console.info call with console.error and update the documentation in the comment above (line 115) to reflect this change. Otherwise, the added console.error should be removed to avoid duplicate logs.

    console.error(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);

@maneesht maneesht requested review from a team as code owners April 10, 2026 17:18
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.

1 participant