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

NextJS deploys failing due to NextJS App Hosting Adapter v14.0.5 #440

Open
1 of 6 tasks
llwire opened this issue Aug 4, 2024 · 8 comments · Fixed by FirebaseExtended/firebase-framework-tools#237
Open
1 of 6 tasks
Labels
kind/bug Something isn't working

Comments

@llwire
Copy link

llwire commented Aug 4, 2024

Describe the bug

Deploys for NextJS backends are failing due to the recent version update in the NextJS apphosting adapter.

After combing through the logs for my last successful deploy and the first failing deploy, I noticed that the only difference was that the @apphosting/adapter-nextjs version was bumped up to version 14.0.5 in the failing case. I believe this is the cause of the issues. All of my failing deploy install and try to run 14.0.5.

Those two deploys were just over an hour apart and the only change between the two commits a text change, so it would not affect deploys.

Additional context
How are you using GCP buildpacks?

  • pack and the gcr.io/buildpacks/builder
  • Cloud Functions
  • Cloud Run
  • Cloud Build
  • App Engine Standard
  • App Engine Flex

Did this used to work?
Yes, it used to work.

The last working deploy and first failing deploy were 1hr and 10mins apart, with no breaking code changes.

What language is your project primarily written in?
Node.js

Steps To Reproduce
Steps to reproduce the behavior:

  1. Anything that triggers a deploy

Expected behavior
The app to deploy.

Actual behavior
ERROR: failed to build: exit status 1
ERROR: failed to build: executing lifecycle: failed with status code: 51

Success Log Snippet

2024-07-25 01:44:14.143 EDT
Step #2: === Node.js - Firebasenextjs ([email protected]) ===
2024-07-25 01:44:14.145 EDT
Step #2: WARNING: *** You are using a custom build command (your build command is NOT 'next build'), we will accept it as is but will error if output structure is not as expected ***
2024-07-25 01:44:14.145 EDT
Step #2: ***** CACHE MISS: "npm_modules"
2024-07-25 01:44:14.146 EDT
Step #2: Installing nextjs adaptor 14.0.4
2024-07-25 01:44:16.869 EDT
Step #2: === Node.js - Yarn ([email protected]) ===
2024-07-25 01:44:16.869 EDT
Step #2: 2024/07/25 05:44:16 [DEBUG] GET https://registry.npmjs.org/yarn
2024-07-25 01:44:16.973 EDT
Step #2: ***** CACHE MISS: "yarn_engine"
2024-07-25 01:44:16.974 EDT
Step #2: Installing Yarn v1.22.22
2024-07-25 01:44:16.974 EDT
Step #2: 2024/07/25 05:44:16 [DEBUG] GET https://yarnpkg.com/downloads/1.22.22/yarn-v1.22.22.tar.gz
2024-07-25 01:44:17.534 EDT
Step #2: Setting environment variable PATH=/layers/google.nodejs.yarn/yarn_engine/bin:/layers/google.nodejs.runtime/node/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
2024-07-25 01:44:17.552 EDT
Step #2: ***** CACHE MISS: "yarn_modules"
2024-07-25 01:44:17.553 EDT
Step #2: --------------------------------------------------------------------------------
2024-07-25 01:44:17.553 EDT
Step #2: Running "yarn install --non-interactive --prefer-offline --modules-folder=/layers/google.nodejs.yarn/yarn_modules/node_modules --frozen-lockfile --production=false (PATH=/layers/google.nodejs.yarn/yarn_engine/bin:/layers/google.nodejs.runtime/node/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/layers/google.nodejs.yarn/yarn_modules/node_modules/.bin)"
2024-07-25 01:44:17.929 EDT
Step #2: yarn install v1.22.22
2024-07-25 01:44:18.045 EDT
Step #2: [1/4] Resolving packages...
2024-07-25 01:44:18.670 EDT
Step #2: [2/4] Fetching packages...
2024-07-25 01:45:11.713 EDT
Step #2: [3/4] Linking dependencies...
2024-07-25 01:45:11.741 EDT
Step #2: warning " > @graphql-codegen/[email protected]" has unmet peer dependency "graphql-tag@^2.0.0".
2024-07-25 01:45:34.769 EDT
Step #2: [4/4] Building fresh packages...
2024-07-25 01:45:35.604 EDT
Step #2: Done in 77.68s.
2024-07-25 01:45:35.646 EDT
Step #2: Done "yarn install --non-interactive --prefer-offline --modules-fo..." (1m18.092596983s)
2024-07-25 01:45:35.646 EDT
Step #2: --------------------------------------------------------------------------------
2024-07-25 01:45:35.646 EDT
Step #2: Running "npm exec --prefix /layers/google.nodejs.firebasenextjs/npm_modules apphosting-adapter-nextjs-build"
2024-07-25 01:45:36.427 EDT
Step #2: 
2024-07-25 01:45:36.428 EDT
Step #2: > [email protected] build
2024-07-25 01:45:36.428 EDT
Step #2: > next build
2024-07-25 01:45:36.645 EDT
Step #2: yarn run v1.22.22
2024-07-25 01:45:37.253 EDT
Step #2: 
2024-07-25 01:45:37.267 EDT
Step #2: Done in 0.63s.
2024-07-25 01:45:38.171 EDT
Step #2:   ▲ Next.js 14.2.3
2024-07-25 01:45:38.172 EDT
Step #2: 
2024-07-25 01:45:38.193 EDT
Step #2:    Creating an optimized production build ...
2024-07-25 01:46:30.648 EDT
Step #2:  ✓ Compiled successfully

Failure Log Snippet

2024-07-25 14:51:00.928 EDT
Step #2: === Node.js - Firebasenextjs ([email protected]) ===
2024-07-25 14:51:00.930 EDT
Step #2: WARNING: *** You are using a custom build command (your build command is NOT 'next build'), we will accept it as is but will error if output structure is not as expected ***
2024-07-25 14:51:00.930 EDT
Step #2: ***** CACHE MISS: "npm_modules"
2024-07-25 14:51:00.931 EDT
Step #2: Installing nextjs adaptor 14.0.5
2024-07-25 14:51:04.210 EDT
Step #2: === Node.js - Yarn ([email protected]) ===
2024-07-25 14:51:04.210 EDT
Step #2: 2024/07/25 18:51:04 [DEBUG] GET https://registry.npmjs.org/yarn
2024-07-25 14:51:04.346 EDT
Step #2: ***** CACHE MISS: "yarn_engine"
2024-07-25 14:51:04.347 EDT
Step #2: Installing Yarn v1.22.22
2024-07-25 14:51:04.347 EDT
Step #2: 2024/07/25 18:51:04 [DEBUG] GET https://yarnpkg.com/downloads/1.22.22/yarn-v1.22.22.tar.gz
2024-07-25 14:51:04.895 EDT
Step #2: Setting environment variable PATH=/layers/google.nodejs.yarn/yarn_engine/bin:/layers/google.nodejs.runtime/node/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
2024-07-25 14:51:04.912 EDT
Step #2: ***** CACHE MISS: "yarn_modules"
2024-07-25 14:51:04.914 EDT
Step #2: --------------------------------------------------------------------------------
2024-07-25 14:51:04.914 EDT
Step #2: Running "yarn install --non-interactive --prefer-offline --modules-folder=/layers/google.nodejs.yarn/yarn_modules/node_modules --frozen-lockfile --production=false (PATH=/layers/google.nodejs.yarn/yarn_engine/bin:/layers/google.nodejs.runtime/node/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/layers/google.nodejs.yarn/yarn_modules/node_modules/.bin)"
2024-07-25 14:51:05.297 EDT
Step #2: yarn install v1.22.22
2024-07-25 14:51:05.420 EDT
Step #2: [1/4] Resolving packages...
2024-07-25 14:51:06.065 EDT
Step #2: [2/4] Fetching packages...
2024-07-25 14:52:03.232 EDT
Step #2: [3/4] Linking dependencies...
2024-07-25 14:52:03.270 EDT
Step #2: warning " > @graphql-codegen/[email protected]" has unmet peer dependency "graphql-tag@^2.0.0".
2024-07-25 14:52:27.858 EDT
Step #2: [4/4] Building fresh packages...
2024-07-25 14:52:28.737 EDT
Step #2: Done in 83.45s.
2024-07-25 14:52:28.781 EDT
Step #2: Done "yarn install --non-interactive --prefer-offline --modules-fo..." (1m23.867885204s)
2024-07-25 14:52:28.782 EDT
Step #2: --------------------------------------------------------------------------------
2024-07-25 14:52:28.782 EDT
Step #2: Running "npm exec --prefix /layers/google.nodejs.firebasenextjs/npm_modules apphosting-adapter-nextjs-build"
2024-07-25 14:54:01.403 EDT
Step #2: /layers/google.nodejs.firebasenextjs/npm_modules/node_modules/@apphosting/common/dist/index.js:22
2024-07-25 14:54:01.403 EDT
Step #2:                 reject(new Error(`Process exited with error code ${code}. Output: ${buildOutput}`));
2024-07-25 14:54:01.403 EDT
Step #2:                        ^
2024-07-25 14:54:01.403 EDT
Step #2: 
2024-07-25 14:54:01.403 EDT
Step #2: Error: Process exited with error code 1.
@llwire llwire added the kind/bug Something isn't working label Aug 4, 2024
@donpui
Copy link

donpui commented Aug 5, 2024

I have exactly the same issue. Also tried pack locally, get also the same issue:
pack build --builder=gcr.io/buildpacks/firebase-app-hosting-22/builder:latest <project>

builder] Running "npm ci --quiet (NODE_ENV=development)"
[builder] npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
[builder] npm warn deprecated [email protected]: This package is no longer supported.
[builder] npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
[builder] npm warn deprecated [email protected]: This package is no longer supported.
[builder] npm warn deprecated [email protected]: This package is no longer supported.
[builder] npm warn deprecated @humanwhocodes/[email protected]: Use @eslint/object-schema instead
[builder] npm warn deprecated @humanwhocodes/[email protected]: Use @eslint/config-array instead
[builder] npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
[builder] 
[builder] added 579 packages, and audited 580 packages in 35s
[builder] 
[builder] 147 packages are looking for funding
[builder]   run `npm fund` for details
[builder] 
[builder] found 0 vulnerabilities
[builder] Done "npm ci --quiet (NODE_ENV=development)" (35.019103975s)
[builder] --------------------------------------------------------------------------------
[builder] Running "npm exec --prefix /layers/google.nodejs.firebasenextjs/npm_modules apphosting-adapter-nextjs-build"
[builder] Done "npm exec --prefix /layers/google.nodejs.firebasenextjs/npm_m..." (1m12.641180659s)
[builder] --------------------------------------------------------------------------------
[builder] Running "npm prune --production"
[builder] npm warn config production Use `--omit=dev` instead.
[builder] 
[builder] up to date, audited 267 packages in 2s
[builder] 
[builder] 19 packages are looking for funding
[builder]   run `npm fund` for details
[builder] 
[builder] found 0 vulnerabilities
[builder] Done "npm prune --production" (2.002502209s)
[builder] === Node.js - Firebasebundle ([email protected]) ===
[builder] --------------------------------------------------------------------------------
[builder] failed to build: (error ID: 6fa8e297):
[builder] looking up output bundle env FIREBASE_OUTPUT_BUNDLE_DIR
[builder] --------------------------------------------------------------------------------
[builder] Sorry your project couldn't be built.
[builder] Our documentation explains ways to configure Buildpacks to better recognise your project:
[builder]  -> https://cloud.google.com/docs/buildpacks/overview
[builder] If you think you've found an issue, please report it:
[builder]  -> https://github.com/GoogleCloudPlatform/buildpacks/issues/new
[builder] --------------------------------------------------------------------------------
[builder] Timer: Builder ran for 2m7.854129725s and ended at 2024-08-05T08:33:45Z
[builder] ERROR: failed to build: exit status 1
ERROR: failed to build: executing lifecycle: failed with status code: 51

@zuldy
Copy link

zuldy commented Aug 5, 2024

I also have the same issue, started yesterday.

INFO 2024-08-05T09:41:26.110880799Z Step #2: Sorry your project couldn't be built.
INFO 2024-08-05T09:41:26.110881335Z Step #2: Our documentation explains ways to configure Buildpacks to better recognise your project:
INFO 2024-08-05T09:41:26.110881796Z Step #2: -> https://cloud.google.com/docs/buildpacks/overview
INFO 2024-08-05T09:41:26.110890419Z Step #2: If you think you've found an issue, please report it:
INFO 2024-08-05T09:41:26.110890934Z Step #2: -> https://github.com/GoogleCloudPlatform/buildpacks/issues/new
INFO 2024-08-05T09:41:26.110891434Z Step #2: --------------------------------------------------------------------------------
INFO 2024-08-05T09:41:26.112499817Z Step #2: Timer: Builder ran for 2m9.077105853s and ended at 2024-08-05T09:41:26Z
INFO 2024-08-05T09:41:26.112510126Z Step #2: ERROR: failed to build: exit status 1
INFO 2024-08-05T09:41:29.862577282Z Step #2: ERROR: failed to build: executing lifecycle: failed with status code: 51
INFO 2024-08-05T09:41:30.107040511Z Finished Step #2
INFO 2024-08-05T09:41:30.107233481Z ERROR
INFO 2024-08-05T09:41:30.107260485Z ERROR: build step 2 "gcr.io/k8s-skaffold/pack" failed: step exited with non-zero status: 1

@dorraba
Copy link

dorraba commented Aug 5, 2024

Any updates on this? happens to me too

@Yuangwang
Copy link

Hi Firebase employee here, thank you for bringing this up. We are looking into it now and will provide updates in this thread

@llwire
Copy link
Author

llwire commented Aug 9, 2024

Hey, just checking if there is any update on this? It's a bit of a blocker for me, this getting fixed would be a major help.

Thanks in advance!

@Yuangwang
Copy link

Hi, yes we've identified the issue and merged the fix in FirebaseExtended/firebase-framework-tools#237.

We're currently rolling out the fix to everyone so please try to rerun your build in the coming days

@connershoop
Copy link

Can confirm this fixed my issue, can now see app hosting deployment errors properly

@llwire
Copy link
Author

llwire commented Aug 14, 2024

Same here - I can see the deployment errors properly.

In my case, the error was that the firebase Admin initializeApp() call was missing config parameters. This is strange because the application should have been used but it wasn't, and that didn't seem to be an issue until the update I referenced above.

For now I get by with the code below, but I wonder if there is more to uncover here.

firebaseAdminApp = admin.initializeApp({
  projectId: firebaseConfig.projectId,
  credential: applicationDefault(),
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
6 participants