Gatsby Cloud deploying wrong site version to Netlify

I’m trying to deploy a site to Netlify via Gatsby Cloud, however each time I get the following error:
Deploy Error from Netlify: In file "/tmp/functions-ce9e1ac8-de21-4816-908d-5998fed6dd47/functions/careers-response.js": Cannot find module '@sendgrid/mail' Require stack...

The bizarre thing is, I removed the ‘careers-response.js’ function from the /functions folder - it does not exist ANYWHERE in the repo. How is Netlify still seeing this? Is it cached somewhere? If so is there a way to purge?

You can try “Clear cache and deploy” if that’s what you’re looking for:

image

It’s building on Gatsby Cloud and pushing that build to Netlify, so there’s no option to do this on the UI

Also this is what is showing in the Netlify deploy log

6:37:04 PM: Creating deploy upload records
6:37:09 PM: Invalid AWS Lambda parameters. Reserved keys used in this request

Seems like the deploy is using some keys that are reserved. Do you have a control over this?

None of the environment variables match any of the AWS reserved variables.

https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html

Due to that function which is not in the repo causing the error, my feeling is that either Gatsby Cloud is sending the wrong build to Netlify, or Netlify is pulling an old build.

Could you create a new website with the current setup and see if it works?

I tried getting Gatsby Cloud to push to a new Netlify site. Got the same error when it tried to deploy to Netlify, and nothing is showing up in the new site’s overview.

Then maybe Gatsby Cloud is messing up. I’ve never used it personally, but I guess it depends on cache of the previous builds and thus the error probably.

Triggered a rebuild on Gatsby Cloud this morning and its all working as it should now. Must have been a Gatsby Cloud issue.