Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG - Amplify is not serving correct build #2540

Closed
4 tasks done
alastairayliffe opened this issue Jan 24, 2022 · 28 comments
Closed
4 tasks done

BUG - Amplify is not serving correct build #2540

alastairayliffe opened this issue Jan 24, 2022 · 28 comments
Labels
archived This issue has been locked. bug Something isn't working hosting

Comments

@alastairayliffe
Copy link

alastairayliffe commented Jan 24, 2022

Before opening, please confirm:

App Id

df9v3hnihrz8x

Region

us-east-1

Amplify Console feature

Build settings

Describe the bug

I have multiple git branches connected to the Amplify app ('local', 'develop', 'production').

develop and production don't appear to be updating with the latest build on either the amplify URL, or the domain name I've added.

Expected behavior

When merging changes into my develop and production branches within Git, I was expecting amplify to update with the latest changes (post build).

Reproduction steps

  1. I created 2 amplify hosting environments in the same app, linking to 'develop' and 'production' branches in Git (with continual deployment).
  2. I work on a branch called 'local', then merge into 'develop' and 'production' in git, expecting a rebuild, and then see the merged changes reflected when visiting the amplify URL.
  3. These changes were not reflected.
  4. Having tried the above, to check, I created another hosting environment based on the 'local' branch (with all the updates). When the build completed, the 'local' hosting environment displayed the latest.

So it looks the build in amplify does reflect the latest if/when created for the first time ('local' branch in point 5 above), but does not reflect changes when a build is triggered from a merged branch ('develop' and 'production').

Build Settings

version: 1
backend:
  phases:
    build:
      commands:
        - '# Execute Amplify CLI with the helper script'
        - amplifyPush --simple
frontend:
  phases:
    preBuild:
      commands:
        - yarn install
    build:
      commands:
        - yarn run build
  artifacts:
    baseDirectory: build
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

Additional information

No response

@github-actions
Copy link

Hi 👋, thanks for opening! While we look into this...

If this issue is related to custom domains, be sure to check the custom domains troubleshooting guide to see if that helps. Also, there is a more general troubleshooting FAQ that may be helpful for other questions.

Lastly, please make sure you've specified the App ID and Region in the issue!

@ghost ghost self-assigned this Jan 25, 2022
@ghost
Copy link

ghost commented Jan 25, 2022

Hi @alastairayliffe 👋🏽, if you are merging locally then you'll have to push the changes in your develop or production branch after merging from local. Merging locally won't trigger a new build because Amplify is hosting code stored in the remote repository on GitHub. Additionally, if you open a pull request to merge from local to another branch that is deployed in Amplify and approve the merge request in GitHub, a new build will be triggered.

@ghost
Copy link

ghost commented Jan 25, 2022

Please let me know if I misunderstood your issue or if I can provide more assistance.

@ghost ghost added question Further information is requested hosting labels Jan 25, 2022
@alastairayliffe
Copy link
Author

Hi @hloriana,

Thanks for the response and apologies for the confusion.

Just to confirm, I'm pushing my 'local' branch up to git. Within Git, I'm then merging my 'local' branch into the 'develop' and 'production' branches (in hindsight, I shouldn't call a branch 'local' as this is making it mega confusing :)...

But to clarify, I'm not merging locally (all merging is done in git).

So currently, within Git, all branches ('local', 'develop' and 'production') are the same (within git, I merged 'local' into 'develop' and then 'develop' into 'production').

Within Amplify, the develop and production hosted environments (linked to 'develop' and 'production' branches in Git) are references an older version...

It's quite odd...

The provision log within amplify does appear to be pulling correctly from Git (within git, the develop branch is 'c3d08e7', which matches the log in amplify. See below for snippet from amplify provision log)-

HEAD is now at c3d08e7 Merge pull request #15 from alastairayliffe/local

So it does appear to be pulling correctly from Git... But when I look at the end result, it doesn't appear to be updating...

I updated the name from Hey Presto to Consumabull and merged all branches in Git...

This is what it should look like if referencing the latest branch-

Screenshot 2022-01-26 at 10 04 44

This is what it currently looks like (even after redeployment in my production and develop branches)-

Screenshot 2022-01-26 at 10 04 34

It's a bit confusion to me... Would it help if I share all amplify logs?

Thanks,

@mai1015
Copy link

mai1015 commented Jan 27, 2022

I have a similar issue, that the new build does not reflect on the production site. One thing I notice is that the build time was normally around 15 mins, but it is now 6mins and nothing is updating. It is SSR backed by next.js and served in performance mode in amplify.

@tmrclark
Copy link

tmrclark commented Jan 27, 2022

Similar issue. Using next.js. Made updates to master branch, pushed to github, amplify build is triggered and runs successfully, then go to the site and its serving the old version of master. I looked in the S3 bucket for the amplify project and it looks like no new files are added and nothing is changed from the build.

I have not changed anything about how I deploy, and even has a successful deployment yesterday with no issues. AppId: dhyps894sr29r. Region us-east-2

@tmaxfieldaa
Copy link

tmaxfieldaa commented Jan 27, 2022

Similar issue. Using next.js. Made updates to master branch, pushed to github, amplify build is triggered and runs successfully, then go to the site and its serving the old version of master. I looked in the S3 bucket for the amplify project and it looks like no new files are added and nothing is changed from the build.

I have not changed anything about how I deploy, and even has a successful deployment yesterday with no issues. AppId: dhyps894sr29r. Region us-east-2

Also using Next.JS and SSR. My build time has been cut in ~half similar to mai1015. I am also experiencing this issue (seemingly no propagation of changes to Cloudfront) as my Cloudfront has a last modified date of 1 week prior to Amplify's last successful build and timestamp (1/27/2022).

@charlieboles
Copy link

Any update on this? I can no longer update several production sites.

@alissonsleal
Copy link

I was having the same problem yesterday, it started working today again, didn't have to change anything on my end

@alastairayliffe
Copy link
Author

Hi, I just tried again and it's still not working for me (serving old builds).

Thanks,

@swaminator
Copy link
Contributor

@alissonsleal @charlieboles are you still facing hte issue?

@ferdingler
Copy link
Contributor

@alastairayliffe any chance this is related to caching? Do you have custom headers configured where you may be setting a cache-control header with a long max-age value?

@charlieboles
Copy link

@swaminator I cannot tell, now instead of failing silently, existing branches experience this issue #2551 on redeploy. Here's an app id for reference: dbq6c91n3hrjc. This issue is more severe as now sites will experience downtime instead of defaulting to the last working build.

@carlosbvz
Copy link

@charlieboles , agree on the severity.
This issue has taken our site practically down since most of the data cannot be served to the Front End.

@alastairayliffe
Copy link
Author

@alastairayliffe any chance this is related to caching? Do you have custom headers configured where you may be setting a cache-control header with a long max-age value?

I don't think so. I don't have any caching set up...

@alissonsleal
Copy link

@alissonsleal @charlieboles are you still facing hte issue?

no, it's working fine on us-east-2, it's slower than yesterday but atleast it's working now.

image

The 4 minute builds weren't being deployed, but the 11 minute ones are working fine

@alastairayliffe
Copy link
Author

alastairayliffe commented Feb 1, 2022

Hey, having run a few tests, it might actually be the cache :)...

If anyone else experiences a similar issue, I took the below out of my build spec and that seemed to do the trick...

  cache:
    paths:
      - node_modules/**/*

Build spec post change looks like -

version: 1
backend:
  phases:
    build:
      commands:
        - '# Execute Amplify CLI with the helper script'
        - amplifyPush --simple
frontend:
  phases:
    preBuild:
      commands:
        - yarn install
    build:
      commands:
        - yarn run build
  artifacts:
    baseDirectory: build
    files:
      - '**/*'
 cache:
    paths:
      - node_modules/**/*

@ghost
Copy link

ghost commented Feb 2, 2022

@charlieboles and @carlosbvz can you try @alastairayliffe's workaround to see if this unblocks you? We are investigating this further.

@ghost ghost added bug Something isn't working and removed question Further information is requested labels Feb 3, 2022
@carlosbvz
Copy link

Hi @hloriana ,

Not really,
I made a test this morning (enabling my NextJs lambdas again), but I got the same error:

503 ERROR
The request could not be satisfied.

Screen Shot 2022-02-11 at 11 45 51

@victorccccc
Copy link
Contributor

Closing this issue but feel free to re-open this if you have questions.

@dayhaysoos
Copy link

@victorccccc this is still a problem for me. I've tried the advice in here, no matter what I do I cannot get an updated version of the frontend deployed.

@victorccccc
Copy link
Contributor

@dayhaysoos Hi, can you share your appId? Thanks

@dayhaysoos
Copy link

@victorccccc the appId is: d3vb0tcd5f5lde

It seems that it only rebuilds the initial deploy I've done when I set this up. I followed the instructions from the docs site on the set up

@ghost ghost reopened this Mar 31, 2022
@syedali-intellia
Copy link

any update on this issue ?

@7flash
Copy link

7flash commented Nov 4, 2022

Same issue

@ghost ghost removed their assignment Jul 7, 2023
@swaminator
Copy link
Contributor

We have since launched fully managed Next.js support and have not heard about a reoccurence of this issue. Resolving.

Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Copy link

This issue has been automatically locked.

@github-actions github-actions bot added the archived This issue has been locked. label Mar 20, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Mar 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived This issue has been locked. bug Something isn't working hosting
Projects
None yet
Development

No branches or pull requests