Netlify deploy --prod Error: Project not found. Please rerun "netlify link"

  • We need to know your netlify site name. tv-devsite.netlify.app
  • DNS issues? no custom domain
  • Build problems? netlify deploy problem using CI CD pipeline in gitlab

The pipeline steps in details:

#stored auth token variable in CI CD variables section and exported as well when running pipeline

  • export NETLIFY_AUTH_TOKEN=“$NETLIFY_AUTH_TOKEN”

run sites list to confirm authentication

  • netlify sites:list

this step works fine and displays all my site IDs

run netlify deployment

netlify deploy \ --site=“30074e84-2732-4f8c-a56f-a5f6af89fd96” \ --prod

this fails with error
Error: Project not found. Please rerun “netlify link”

this is a linux machine running docker image node:24

need some help here to troubleshoot, site id is 30074e84-2732-4f8c-a56f-a5f6af89fd96

I don’t know if this helps, I’m able to run the deployment now,

this is what I changed

using
rm -rf .netlify
in the steps before starting build

using an auth check condition like this
netlify sites:list || { echo "Auth failed"; exit 1; }
to verify that auth token loaded from CICD pipeline library properly when the pipeline starts

I’ve run two other extra commands

netlify unlink
netlify link --id $NETLIFY_SITE_ID

Also as a last step clean runner caches in the pipelines menu in gitlab

The steps did not work reliably, turn out there is more to this.

It worked few times but started failing consistently again and again.

I will wait for a solution to this.

this is finally solved, the firewall was blocking access to

api.netlifysdk.com
dl.deno.land

also allow
api.netlify.com

these will solve the problem of error like “Error: Project not found. Please rerun “netlify link””