Severin
Severin

Reputation: 8588

Google Cloud Build - source-context.json SHA mismatch

I have a Python 3 project which I am hosting on Google AppEngine Standard. Until a couple of days ago I was able to deploy normally (right since I did the initial setup in July 2019) until a couple of days ago. Now I get the following response:

starting build "abc"

FETCHSOURCE
BUILD
Starting Step #0 - "fetcher"
Step #0 - "fetcher": Already have image (with digest): gcr.io/cloud-builders/gcs-fetcher
Step #0 - "fetcher": Fetching manifest gs://staging.my-project.appspot.com/ae/xxx/manifest.json.
Step #0 - "fetcher": Processing 312 files.
Step #0 - "fetcher": Failed to fetch gs://staging.my-project.appspot.com/xxx, will no longer retry: fetching "gs://staging.my-project.appspot.com/xxx" with timeout 1h0m0s to temp file "/workspace/.download/staging.my-project.appspot.com-xxx": source-context.json SHA mismatch, got "xxx", want "yyy"
Step #0 - "fetcher": Failed to download at least one file. Cannot continue.
Finished Step #0 - "fetcher"
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/gcs-fetcher" failed: step exited with non-zero status: 1

Any idea why this would be happening and how to fix it?

P.S. I use the following command for deployment:

gcloud --project my-project app deploy app.yaml

Upvotes: 7

Views: 2198

Answers (4)

MColl
MColl

Reputation: 1

For anyone using a NextJS project the solution may be to delete the .next folder and rebuild your project. It seems the some of the cache files from next can become out of sync.

From the root of your project:

rm -rf .next && next build

then redeploy as usual

Upvotes: 0

Israel
Israel

Reputation: 1454

This is what I did and it worked for me:

1. Go to the link that in the error description:

enter image description here

2. You'll see there some lines for staging fail, copy the name of the file in the first line:

enter image description here

3. Go to the Google storage here and enter to a bucket with name that starts with "staging.***" And inside that bucket I search for the string I copy in step 2:

enter image description here

4. Deleted that file, and retry that steps for every line you'll see in the error details link (in my example there are 4 rows).

enter image description here

5. Deploy again!

Upvotes: 10

Pierre Carbonnelle
Pierre Carbonnelle

Reputation: 2615

I had a similar problem after I changed a local file during a gcloud app deploy with a long upload (2200 files, because of a wrong .gcloudignore).

I fixed it by deleting the changed file in the cloud storage browser, and deploying again with gcloud app deploy.

Upvotes: 2

Navid
Navid

Reputation: 394

After conversation with Google engineers (https://issuetracker.google.com/issues/154588981?pli=1) the following worked:

  1. Remove the source-context.json file
  2. Delete the bucket where the deployment files are, e.g. gs://staging.my-project.appspot.com
  3. Deploy again

If you need the source-context.json file, you can follow these steps: https://www.google.com/url?q=https://cloud.google.com/debugger/docs/source-context&sa=D&usg=AFQjCNHMB7Dm_jISwG2AnpokQ7XN5GmLAw

Upvotes: 9

Related Questions