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

Error: Can't resolve 'amplifyconfiguration.json' in build stage #13668

Closed
marcusoyang opened this issue Mar 23, 2024 · 5 comments
Closed

Error: Can't resolve 'amplifyconfiguration.json' in build stage #13668

marcusoyang opened this issue Mar 23, 2024 · 5 comments
Labels
hosting Issues tied to hosting category pending-triage Issue is pending triage question General question

Comments

@marcusoyang
Copy link

marcusoyang commented Mar 23, 2024

Amplify CLI Version

12.10.1

Question

Hello,

I recently migrated my nextjs app from Amplify v5 to v6. Locally it builds fine but when building through Amplify, the json file isn't being generated.

Type error: Cannot find module '../components/amplifyconfiguration.json' or its corresponding type declarations.

version: 1
backend:
  phases:
    build:
      commands:
        - '# Execute Amplify CLI with the helper script'
        - yarn global add @aws-amplify/cli
        - amplifyPush --simple

image

@marcusoyang marcusoyang added pending-triage Issue is pending triage question General question labels Mar 23, 2024
@marcusoyang
Copy link
Author

Update: When I run amplify pull, aws-exports.js and amplifyconfiguration.json are both being generated locally. However, neither are being generated on the build stage on Amplify.

@marcusoyang
Copy link
Author

Changing the build image to Amazon Linux:2023 has changed the error to:

image

@ykethan
Copy link
Member

ykethan commented Mar 26, 2024

@marcusoyang from the error message this appears to be a permissions error. Does the hosting build have a service role attached? refer to https://docs.aws.amazon.com/amplify/latest/userguide/how-to-service-role-amplify-console.html providing this information.

@ykethan ykethan added hosting Issues tied to hosting category pending-response Issue is pending response from the issue author labels Mar 26, 2024
@marcusoyang
Copy link
Author

@ykethan Thank you, issue solved. Seems like the role lost privileges for some reason or the previous role got removed.

Solution: Make sure Amplify service role has the AdministratorAccess-Amplify policy and use Amazon Linux:2023 build image.

@github-actions github-actions bot removed the pending-response Issue is pending response from the issue author label Mar 26, 2024
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hosting Issues tied to hosting category pending-triage Issue is pending triage question General question
Projects
None yet
Development

No branches or pull requests

2 participants