GoogleCloudPlatform / buildpacks

Builders and buildpacks designed to run on Google Cloud's container platforms
Apache License 2.0
987 stars 146 forks source link

NodeJs building error behind the corporate proxy #344

Open vongosling opened 1 year ago

vongosling commented 1 year ago

Describe the bug Please provide a clear and concise description of what the bug is.

Got some errors when run skaffold dev using example code from the https://github.com/GoogleContainerTools/skaffold

Logs:

Generating tags...
 - skaffold-buildpacks-node -> skaffold-buildpacks-node:v2.7.0-19-g1e98823bc-dirty
Checking cache...
 - skaffold-buildpacks-node: Not found. Building
Starting build...
Found [custom] context, using local docker daemon.
Building [skaffold-buildpacks-node]...
Target platforms: [linux/amd64]
v1: Pulling from buildpacks/builder
Digest: sha256:0219dbf1f29ce5e9452f5194f4402fcf048a962c7a5b44061839d894e1eb9497
Status: Image is up to date for gcr.io/buildpacks/builder:v1
v1: Pulling from buildpacks/gcp/run
Digest: sha256:58e739a57b27343ed2c86b39914f46b00fb75d395c7a139a47ea98d37198dada
Status: Image is up to date for gcr.io/buildpacks/gcp/run:v1
0.17.0: Pulling from buildpacksio/lifecycle
Digest: sha256:bc0d791f89bda0e8fbf9bf3e47c2faf1ac4eca4b16f0b01c6cb606883759766a
Status: Image is up to date for buildpacksio/lifecycle:0.17.0
===> ANALYZING
[analyzer] Timer: Analyzer started at 2023-09-22T04:36:15Z
[analyzer] Image with name "skaffold-buildpacks-node:latest" not found
[analyzer] Timer: Analyzer ran for 44.411µs and ended at 2023-09-22T04:36:15Z
===> DETECTING
[detector] Timer: Detector started at 2023-09-22T04:36:31Z
[detector] 3 of 5 buildpacks participating
[detector] google.nodejs.runtime    1.0.0
[detector] google.nodejs.npm        1.0.0
[detector] google.utils.label-image 0.0.2
[detector] Timer: Detector ran for 491.747778ms and ended at 2023-09-22T04:36:31Z
===> RESTORING
[restorer] Timer: Restorer started at 2023-09-22T04:36:48Z
[restorer] Timer: Restorer ran for 948.991µs and ended at 2023-09-22T04:36:48Z
===> BUILDING
[builder] Timer: Builder started at 2023-09-22T04:37:05Z
[builder] === Node.js - Runtime (google.nodejs.runtime@1.0.0) ===
[builder] Using runtime version from GOOGLE_RUNTIME_VERSION: 14.3.0
[builder] ***** CACHE MISS: "nodejs"
[builder] Installing Node.js v14.3.0.
[builder] 2023/09/22 04:37:05 [DEBUG] GET https://dl.google.com/runtimes/ubuntu1804/nodejs/nodejs-14.3.0.tar.gz
[builder] Warning: BOM table is deprecated in this buildpack api version, though it remains supported for backwards compatibility. Buildpack authors should write BOM information to <layer>.sbom.<ext>, launch.sbom.<ext>, or build.sbom.<ext>.
[builder] Warning: BOM table is deprecated in this buildpack api version, though it remains supported for backwards compatibility. Buildpack authors should write BOM information to <layer>.sbom.<ext>, launch.sbom.<ext>, or build.sbom.<ext>.
[builder] Warning: BOM table is deprecated in this buildpack api version, though it remains supported for backwards compatibility. Buildpack authors should write BOM information to <layer>.sbom.<ext>, launch.sbom.<ext>, or build.sbom.<ext>.
[builder] === Node.js - Npm (google.nodejs.npm@1.0.0) ===
[builder] Generating package-lock.json.
[builder] WARNING: *** Improve build performance by generating and committing package-lock.json.
[builder] --------------------------------------------------------------------------------
[builder] Running "npm install --package-lock-only --quiet"
[builder] npm
[builder]  ERR! code SELF_SIGNED_CERT_IN_CHAIN
[builder] npm
[builder]  ERR! errno
[builder]  SELF_SIGNED_CERT_IN_CHAIN
[builder] npm
[builder] ERR! request to https://registry.npmjs.org/express failed, reason: self signed certificate in certificate chain
[builder]
[builder] npm
[builder]
[builder] ERR!
[builder]  A complete log of this run can be found in:
[builder] npm
[builder]
[builder] ERR!
[builder]      /home/cnb/.npm/_logs/2023-09-22T04_37_52_876Z-debug.log
[builder] Done "npm install --package-lock-only --quiet" (1.828691035s)
[builder] --------------------------------------------------------------------------------
[builder] failed to build: (error ID: b0ba1f57):
[builder] npm ERR! code SELF_SIGNED_CERT_IN_CHAIN
[builder] npm ERR! errno SELF_SIGNED_CERT_IN_CHAIN
[builder] npm ERR! request to https://registry.npmjs.org/express failed, reason: self signed certificate in certificate chain
[builder]
[builder] npm ERR! A complete log of this run can be found in:
[builder] npm ERR!     /home/cnb/.npm/_logs/2023-09-22T04_37_52_876Z-debug.log
[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 48.54929714s and ended at 2023-09-22T04:37:52Z
[builder] ERROR: failed to build: exit status 1
Cleaning up...

Another problem, It seems to hard-code the cnb in code(/home/cnb/), which does not exist in my home directory.

jama22 commented 6 months ago

I suspect this might be failing because its trying to reach out through your corporate proxy. Likely could be solved by #125