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

Build fails with "Starting SSR Build... ERROR: AccessDenied: Access Denied" #2192

Closed
4 tasks done
heikkikurkela opened this issue Aug 23, 2021 · 13 comments
Closed
4 tasks done
Labels
archived This issue has been locked. bug Something isn't working ssr Server Side Rendering feature

Comments

@heikkikurkela
Copy link

heikkikurkela commented Aug 23, 2021

Before opening, please confirm:

App Id

d3srkgpabkig16

Region

eu-central-1

Amplify Console feature

Access control

Describe the bug

2021-08-23T07:09:12.169Z [INFO]: Export successful
2021-08-23T07:09:12.174Z [INFO]: Done in 63.27s.
2021-08-23T07:09:12.180Z [INFO]: Starting SSR Build...
2021-08-23T07:10:47.361Z [ERROR]: AccessDenied: Access Denied
                                  at Request.extractError (/root/.//node_modules/aws-sdk/lib/services/s3.js:714:35)
                                  at Request.callListeners (/root/.//node_modules/aws-sdk/lib/sequential_executor.js:106:20)
                                  at Request.emit (/root/.//node_modules/aws-sdk/lib/sequential_executor.js:78:10)
                                  at Request.emit (/root/.//node_modules/aws-sdk/lib/request.js:688:14)
                                  at Request.transition (/root/.//node_modules/aws-sdk/lib/request.js:22:10)
                                  at AcceptorStateMachine.runTo (/root/.//node_modules/aws-sdk/lib/state_machine.js:14:12)
                                  at /root/.//node_modules/aws-sdk/lib/state_machine.js:26:10
                                  at Request.<anonymous> (/root/.//node_modules/aws-sdk/lib/request.js:38:9)
                                  at Request.<anonymous> (/root/.//node_modules/aws-sdk/lib/request.js:690:12)
                                  at Request.callListeners (/root/.//node_modules/aws-sdk/lib/sequential_executor.js:116:18) {
                                  code: 'AccessDenied',
                                  region: null,
                                  time: 2021-08-23T07:10:47.042Z,
                                  requestId: '<ID>',
                                  extendedRequestId: '<ID>',
                                  cfId: undefined,
                                  statusCode: 403,
                                  retryable: false,
                                  retryDelay: 73.0261642244596
                                  }

Expected behavior

Build should be successful since no change

Reproduction steps

Just re-run the pipeline

Build Settings

BuildSpec: |
        version: 1
        frontend:
          phases:
            preBuild:
              commands:
                - yarn install
            build:
              commands:
                - next build && next export
          artifacts:
            baseDirectory: out
            files:
              - '**/*'
          cache:
            paths:
              - node_modules/**/*

Additional information

This problem began to occur from date 8/20/2021, 11:30:39 AM

@heikkikurkela
Copy link
Author

Hi,

This is urgent for us. If possible, could you check this out and tell me where this might come from?

Thanks in advance.

BR,
Heikki

@heikkikurkela
Copy link
Author

Hi,

I fixed this myself following the instructions https://github.com/aws-amplify/amplify-console/blob/master/FAQ.md#convert-an-ssr-app-to-ssg. I did this before and again this problem came up. I don't understand this hassle associated with SSR/SSG recognizing. Our Next.js Amplify app is just static SSG and we are not using any SSR features at all. Our Amplify build pipeline fails from time to time because something always changes in this 'amplify-console' build pipeline related to SSR/SSG recognizing.

@Dovalization
Copy link

This has been happening every time I try to deploy any NextJS app through the console, from GitHub.
I tried @heikkikurkela solution to no avail.

@ferdingler ferdingler added the ssr Server Side Rendering feature label Sep 2, 2021
@ferdingler
Copy link
Contributor

Hi @heikkikurkela, @Dovalization apologies for the delay with this ticket. Just for future reference, we currently identify that an app is SSR if the following criteria is meet:

  • A service IAM role is attached to the app.
  • The app uses Next.js.
  • The build script on the package.json is not next build && next export.

Once an app is treated as SSR, the only way to switch it back to SSG is by following the steps described in this guide: https://github.com/aws-amplify/amplify-console/blob/master/FAQ.md#convert-an-ssr-app-to-ssg. We appreciate your patience while we fine tune the dev experience with SSR apps and thank you for reporting issues!

@annix-markcl
Copy link

I have this issue as well and we need to use SSR. How to fix?

@siegerts
Copy link
Contributor

@annix-markcl , for SSR, you may need more permissions. Can you check the role permissions against https://github.com/aws-amplify/amplify-console/blob/master/FAQ.md#error-accessdenied-access-denied to see if that helps.

Hope that this helps.

@cpv123
Copy link

cpv123 commented Sep 14, 2021

@annix-markcl , for SSR, you may need more permissions. Can you check the role permissions against https://github.com/aws-amplify/amplify-console/blob/master/FAQ.md#error-accessdenied-access-denied to see if that helps.

Hope that this helps.

I think this was the case for me. Using the standard Amplify - Backend Deployment service role gave me this Access Denied error.

I attached the AdministratorAccess policy to my Amplify service role and the deployment worked.

@cpv123
Copy link

cpv123 commented Oct 1, 2021

I think this was the case for me. Using the standard Amplify - Backend Deployment service role gave me this Access Denied error.

I attached the AdministratorAccess policy to my Amplify service role and the deployment worked.

Just an update on my previous comment - this fix doesn't seem to work consistently. I'm now facing this AccessDenied error on a different Amplify project and even assigned full admin permissions doesn't fix it. Same with lots of other people according to #2086

This basically means that deploying SSR Next.js apps on Amplify does not work for many people.

@kenchoong
Copy link

kenchoong commented Dec 22, 2021

I think this was the case for me. Using the standard Amplify - Backend Deployment service role gave me this Access Denied error.
I attached the AdministratorAccess policy to my Amplify service role and the deployment worked.

Just an update on my previous comment - this fix doesn't seem to work consistently. I'm now facing this AccessDenied error on a different Amplify project and even assigned full admin permissions doesn't fix it. Same with lots of other people according to #2086

This basically means that deploying SSR Next.js apps on Amplify does not work for many people.

Yes, sometimes it worked, sometimes it doesn't. Is totally frustrating. I have an app already have 10 PR merge, and 10++ deployments, suddenly it doesnt work today #1876 (comment)

@ghost ghost added the bug Something isn't working label Feb 15, 2022
@calavera
Copy link
Contributor

This might be a duplicated of #1876

@ghost ghost added the s3 label Jan 27, 2023
@ghost ghost removed the s3 label Mar 17, 2023
@ghost
Copy link

ghost commented May 26, 2023

We launched improved support for Next.js applications towards the end of last year: https://aws.amazon.com/blogs/mobile/amplify-next-js-13/

If you haven't already done so, please try migrating your applications to advantage of our new support: https://docs.aws.amazon.com/amplify/latest/userguide/update-app-nextjs-version.html

@ghost ghost closed this as completed May 26, 2023
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot added the archived This issue has been locked. label May 27, 2023
@github-actions github-actions bot locked and limited conversation to collaborators May 27, 2023
This issue was closed.
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 ssr Server Side Rendering feature
Projects
None yet
Development

No branches or pull requests

8 participants