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

Fix Issue #6382 Firebase not working for NextJs >=v13.5.0 #6404

Merged
merged 3 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- Improve performance and reliability when deploying multiple 2nd gen functions using single builds. (#6376)
- Fixed an issue where `emulators:export` did not check if the target folder is empty. (#6313)
- Fix "Could not find the next executable" on Next.js deployments (#6372)
- Fixed "Could not find the next executable" on Next.js deployments (#6372)
- Fixed issues caused by breaking changes in Next >=v13.5.0. (#6382)
2 changes: 1 addition & 1 deletion src/frameworks/next/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@
const DEFAULT_NUMBER_OF_REASONS_TO_LIST = 5;

function getReactVersion(cwd: string): string | undefined {
return findDependency("react-dom", { cwd, omitDev: false })?.version;

Check warning on line 84 in src/frameworks/next/index.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unsafe return of an `any` typed value

Check warning on line 84 in src/frameworks/next/index.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unsafe member access .version on an `any` value
}

/**
* Returns whether this codebase is a Next.js backend.
*/
export async function discover(dir: string) {

Check warning on line 90 in src/frameworks/next/index.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Missing return type on function
if (!(await pathExists(join(dir, "package.json")))) return;
if (!(await pathExists("next.config.js")) && !getNextVersion(dir)) return;

Expand All @@ -110,10 +110,10 @@

const nextBuild = new Promise((resolve, reject) => {
const buildProcess = spawn(cli, ["build"], { cwd: dir });
buildProcess.stdout?.on("data", (data) => logger.info(data.toString()));

Check warning on line 113 in src/frameworks/next/index.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unsafe argument of type `any` assigned to a parameter of type `Error`

Check warning on line 113 in src/frameworks/next/index.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unsafe member access .toString on an `any` value

Check warning on line 113 in src/frameworks/next/index.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unsafe call of an `any` typed value
buildProcess.stderr?.on("data", (data) => logger.info(data.toString()));

Check warning on line 114 in src/frameworks/next/index.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unsafe argument of type `any` assigned to a parameter of type `Error`

Check warning on line 114 in src/frameworks/next/index.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unsafe member access .toString on an `any` value

Check warning on line 114 in src/frameworks/next/index.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unsafe call of an `any` typed value
buildProcess.on("error", (err) => {
reject(new FirebaseError(`Unable to build your Next.js app: ${err}`));

Check warning on line 116 in src/frameworks/next/index.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Invalid type "Error" of template literal expression
});
buildProcess.on("exit", (code) => {
resolve(code);
Expand Down Expand Up @@ -594,7 +594,7 @@
if (gte(version, "12.0.0")) {
const { default: loadConfig } = relativeRequire(dir, "next/dist/server/config");
const { PHASE_PRODUCTION_BUILD } = relativeRequire(dir, "next/constants");
config = await loadConfig(PHASE_PRODUCTION_BUILD, dir, null);
config = await loadConfig(PHASE_PRODUCTION_BUILD, dir);
} else {
try {
config = await import(pathToFileURL(join(dir, "next.config.js")).toString());
Expand Down
Loading