Automatic prod branch builds for monorepo nextjs app do not update code

Site name: priceless-volhard-14b73c

Automated builds from the prod branch for my site (main branch) do not update the code running on the branch endpoint. The build will successfully trigger, and will succeed & publish, however the code running is not the correct revision of the code.

Running a ntl deploy --build will successfully incorporate the latest changes.

How can I debug this issue? I’ve tried clearing the cache, updating the netlify.toml, neither of which have had an effect. At this point I’m considering disabling manual builds and just running my own build system using the ntl cli.

Hey @jlhasson,

At the moment, I can see that you’ve published an older deploy:

Is this expected to you?

Hey hrishikesh, yes, after being unable to get the code to update based on the automatic deploys I ran ntl deploy --build --prod from my branch which correctly updated the code. Previous branch deploys from main did not update with the latest code, therefore I could not publish them

Hey @jlhasson,

Could you please show us what are the “expected” changes vs how exactly it’s looking? It can help us see the problem.

Hey Hrishikesh, it’s difficult for me to describe the expected change without exposing parts of our code. Essentially in our main branch we updated some code, let’s say it was something like obj.some_attribute. In commits prior to this change we would see an error like Exception: obj has no attribute some_attribute. In commits after this change this error went away (because we changed the code to prevent it). I was able to build locally (i.e. yarn install && yarn dev) and see that the new changed worked correctly. Netlify would also trigger builds for the main branch. However, upon accessing the site at http://main--priceless-volhard-14b73c.netlify.com I would see the exception described above, thus indicating that although Netlify had triggered a build the code on the site did not reflect that in main. Does that make sense?

It’s probably too difficult to debug, and I’ve resolved it by manually pushing via ntl deploy --build --prod.

I’m not seeing the error that you mention in the console. In any case, I wonder why you would need to show us your code to show some changes. You could add some simple words or piece of text to make it obvious that something changed.

I’m now seeing the issue again, let me try to describe in detail what I see in a way that you can reproduce/understand:

Between deploys Netlify App (currently “published”) and Netlify App (most recent main branch deploy) I made a code change, the change is to update the expected response code from an API call:

-    if (res.status !== 200) {
+    if (res.status !== 201) {

When I run yarn dev locally and make the API call above, this condition succeeds, i.e. the condition correctly gets a 201 response & continues. In the branch deploy for this commit (found here: https://main--priceless-volhard-14b73c.netlify.app) the condition above fails, as it is still looking for a 200 response thus indicating that the code has not changed. This to me indicates that the deployed code does not contain the above change as expected indicating that the branch deploy did not include the change for some reason.

Is there a way to view the code that is deployed? If that were possible I could verify what I expect to be deployed vs what is actually deployed.