Error: Could not find the site ID. Please run netlify link

Site Name: cmm-choir-be.netlify.app

Error: Could not find the site ID. Please run netlify link.

Build Log:
8:54:41 PM: Waiting for other deploys from your team to complete. Check the queue:
8:55:23 PM: Build ready to start
8:55:33 PM: build-image version: 9289b698a503f132b265bd089ab40ce1d6f9e65e (focal)
8:55:33 PM: build-image tag: v4.12.0
8:55:33 PM: buildbot version: c87074660cd9a4568c0ac759bc083987e94204b3
8:55:33 PM: Fetching cached dependencies
8:55:33 PM: Failed to fetch cache, continuing with build
8:55:33 PM: Starting to prepare the repo for build
8:55:34 PM: No cached dependencies found. Cloning fresh repo
8:55:34 PM: git clone
8:55:34 PM: Preparing Git Reference refs/heads/main
8:55:35 PM: Parsing package.json dependencies
8:55:35 PM: Starting build script
8:55:36 PM: Installing dependencies
8:55:36 PM: Python version set to 2.7
8:55:36 PM: v16.17.1 is already installed.
8:55:36 PM: Now using node v16.17.1 (npm v8.15.0)
8:55:36 PM: Started restoring cached build plugins
8:55:36 PM: Finished restoring cached build plugins
8:55:36 PM: Attempting ruby version 2.7.2, read from environment
8:55:37 PM: Using ruby version 2.7.2
8:55:37 PM: Using PHP version 8.0
8:55:38 PM: No npm workspaces detected
8:55:38 PM: Started restoring cached node modules
8:55:38 PM: Finished restoring cached node modules
8:55:38 PM: Installing NPM modules using NPM version 8.15.0
8:55:38 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
8:55:38 PM: npm WARN config location in the cache, and they are managed by
8:55:38 PM: npm WARN config [cacache]
8:55:38 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
8:55:38 PM: npm WARN config location in the cache, and they are managed by
8:55:38 PM: npm WARN config [cacache]
8:55:50 PM: npm WARN deprecated source-map-url@0.4.1: See
8:55:50 PM: npm WARN deprecated urix@0.1.0: Please see
8:55:50 PM: npm WARN deprecated resolve-url@0.2.1:
8:55:50 PM: npm WARN deprecated source-map-resolve@0.5.3: See
8:55:50 PM: npm WARN deprecated statsd-client@0.4.7: Package no longer supported. Contact Support at for more info.
8:55:51 PM: npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See for details.
8:55:52 PM: npm WARN deprecated @sanskrit-coders/sanscript@1.2.8: Package no longer supported. Contact Support at for more info.
8:55:52 PM: npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
8:55:52 PM: npm WARN deprecated request@2.88.0: request has been deprecated, see
8:55:54 PM: npm WARN deprecated har-validator@5.1.5: this library is no longer supported
8:55:59 PM: npm WARN deprecated core-js@2.6.12: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
8:56:02 PM: added 2297 packages, and audited 2298 packages in 24s
8:56:02 PM: 156 packages are looking for funding
8:56:02 PM: run npm fund for details
8:56:02 PM: 18 vulnerabilities (11 moderate, 7 high)
8:56:02 PM: To address issues that do not require attention, run:
8:56:02 PM: npm audit fix
8:56:02 PM: To address all issues (including breaking changes), run:
8:56:02 PM: npm audit fix --force
8:56:02 PM: Run npm audit for details.
8:56:02 PM: NPM modules installed
8:56:02 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
8:56:02 PM: npm WARN config location in the cache, and they are managed by
8:56:02 PM: npm WARN config [cacache].
8:56:02 PM: Started restoring cached go cache
8:56:02 PM: Finished restoring cached go cache
8:56:02 PM: Installing Go version 1.17 (requested 1.17)
8:56:06 PM: unset GOOS;
8:56:06 PM: unset GOARCH;
8:56:06 PM: export GOROOT=β€˜/opt/buildhome/.gimme/versions/go1.17.linux.amd64’;
8:56:06 PM: export PATH=β€œ/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}”;
8:56:06 PM: go version >&2;
8:56:06 PM: export GIMME_ENV=β€œ/opt/buildhome/.gimme/env/go1.17.linux.amd64.env”
8:56:06 PM: go version go1.17 linux/amd64
8:56:06 PM: Installing missing commands
8:56:06 PM: Verify run directory
8:56:07 PM: ​
8:56:07 PM: ────────────────────────────────────────────────────────────────
8:56:07 PM: Netlify Build
8:56:07 PM: ────────────────────────────────────────────────────────────────
8:56:07 PM: ​
8:56:07 PM: ❯ Version
8:56:07 PM: @netlify/build 27.20.1
8:56:07 PM: ​
8:56:07 PM: ❯ Flags
8:56:07 PM: baseRelDir: true
8:56:07 PM: buildId: 63458ab9160a04000810ce27
8:56:07 PM: deployId: 63458ab9160a04000810ce29
8:56:07 PM: ​
8:56:07 PM: ❯ Current directory
8:56:07 PM: /opt/build/repo
8:56:07 PM: ​
8:56:07 PM: ❯ Config file
8:56:07 PM: /opt/build/repo/netlify.toml
8:56:07 PM: ​
8:56:07 PM: ❯ Context
8:56:07 PM: production
8:56:07 PM: ​
8:56:07 PM: ────────────────────────────────────────────────────────────────
8:56:07 PM: 1. Build command from Netlify app
8:56:07 PM: ────────────────────────────────────────────────────────────────
8:56:07 PM: ​
8:56:07 PM: $ npm run build
8:56:08 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
8:56:08 PM: npm WARN config location in the cache, and they are managed by
8:56:08 PM: npm WARN config [cacache].
8:56:08 PM: > cmm-choir-backend@1.0.0 build
8:56:08 PM: > netlify build lambda
8:56:09 PM: β€Ί Error: Could not find the site ID. Please run netlify link.
8:56:09 PM: ​
8:56:09 PM: ────────────────────────────────────────────────────────────────
8:56:09 PM: β€œbuild.command” failed
8:56:09 PM: ────────────────────────────────────────────────────────────────
8:56:09 PM: ​
8:56:09 PM: Error message
8:56:09 PM: Command failed with exit code 1: npm run build
8:56:09 PM: ​
8:56:09 PM: Error location
8:56:09 PM: In Build command from Netlify app:
8:56:09 PM: npm run build
8:56:09 PM: ​
8:56:09 PM: Resolved config
8:56:09 PM: build:
8:56:09 PM: command: npm run build
8:56:09 PM: commandOrigin: ui
8:56:09 PM: environment:
8:56:09 PM: - ADMIN_SDK_JSON
8:56:09 PM: - ADMIN_UID
8:56:09 PM: - DB_URI
8:56:09 PM: publish: /opt/build/repo/dist
8:56:09 PM: publishOrigin: ui
8:56:09 PM: functions:
8:56:09 PM: β€˜*’:
8:56:09 PM: external_node_modules:
8:56:09 PM: - mongoose
8:56:09 PM: - express
8:56:09 PM: node_bundler: esbuild
8:56:09 PM: functionsDirectory: /opt/build/repo/lambda
8:56:10 PM: Caching artifacts
8:56:10 PM: Started saving node modules
8:56:10 PM: Finished saving node modules
8:56:10 PM: Started saving build plugins
8:56:10 PM: Finished saving build plugins
8:56:10 PM: Started saving pip cache
8:56:10 PM: Finished saving pip cache
8:56:10 PM: Started saving emacs cask dependencies
8:56:10 PM: Finished saving emacs cask dependencies
8:56:10 PM: Started saving maven dependencies
8:56:10 PM: Finished saving maven dependencies
8:56:10 PM: Started saving boot dependencies
8:56:10 PM: Finished saving boot dependencies
8:56:10 PM: Started saving rust rustup cache
8:56:10 PM: Finished saving rust rustup cache
8:56:10 PM: Started saving go dependencies
8:56:10 PM: Finished saving go dependencies
8:56:11 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
8:56:11 PM: Creating deploy upload records
8:56:11 PM: Failing build: Failed to build site
8:56:11 PM: Failed during stage β€˜building site’: Build script returned non-zero exit code: 2
8:56:11 PM: Finished processing build request in 37.873510331s

Linking your app can be done with the netlify-cli
https://www.npmjs.com/package/netlify-cli

If you’ve got netlify-cli installed globally you would then just do this from your app root directory i believe, and follow the instructions:

> netlify link

I tried npx netlify link. It says site already linked.

image

Hi @JeffrinManovaPrabaha

There is no need to run this command when deploying to Netlify. Netlify will automatically build functions in the netlify/functions directory, or in the directory specified in the netlify.toml.

Additionally

This applies on your local machine only, not when building on Netlify.

log that i attached netlify build lambda is from netlify only not from my local machine.

do you mean i should remove directory=lambda from here?

image

do you mean i should remove directory=lambda from here?

I believe you will need that line @JeffrinManovaPrabaha assuming you’ve got your function code living in YOUR_BASE_DIRECTORY/lambda

@JeffrinManovaPrabaha this is total shot in the dark but could you also confirm that you’re building locally with the same node version as the Netlify build environment default of node@16?

I realise that. That is why I said

No, that is not what I said at all.

Can you share the repository you are deploying from @JeffrinManovaPrabaha ?

Correct. If function reside anywhere other than netlify/functions the path needs specifying.

A wild shot it the dark. Hopefully you’re not a sniper! :rofl:

1 Like

yes @jszynal, I am using v16.14.2 on my local machine.

image

yes, I have my functions inside the lambda folder.

image

Actually, I was able to deploy the same code until September 27.

Previously I had my repo on a GitHub organisation account. Since the notice was given by netlify to change it to a private repo as the organisation-owned repo is no longer under the free tier, I switched the repo to a private account. Since then I have started facing this issue…

The problem is, you’re calling netlify cli during your site build.

Depending on what your site’s setup is, you might need to change the build script inside package.json.