-
Notifications
You must be signed in to change notification settings - Fork 96
Closed
Labels
hostingIssue related to Amplify HostingIssue related to Amplify Hostingpending-community-responseIssue is pending a response from the author or communityIssue is pending a response from the author or communityquestionQuestion or confusion about some aspect of the productQuestion or confusion about some aspect of the product
Description
Environment information
> npm error could not determine executable to run.
Node: V22.12.0
NPM: 10.9.0
CDK: 2.174.1 (build f353fc7)
Region: eu-north-1 (have also tried us-east-1 with same result)
Describe the bug
I've been able to use CDK to set up my stack and app in Amplify. This created an IAM Role. The Trust relationships of the role looks like this:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": [
"amplify.eu-north-1.amazonaws.com",
"amplify.amazonaws.com"
]
},
"Action": "sts:AssumeRole"
}
]
}
The role has the following permission policies added for testing purposes:
- AdministratorAccess
- AdministratorAccess-Amplify
My CDK setup looks like this:
const amplifyApp = new amplify.App(this, 'MyAmplifyApp', {
appName: 'my-nextjs-app',
sourceCodeProvider: new amplify.GitHubSourceCodeProvider({
owner: 'my-org',
repository: 'nextjs-amplify-test',
oauthToken: cdk.SecretValue.secretsManager('github-token', {jsonField: 'github-token'}),
}),
buildSpec: BuildSpec.fromObject({
version: '1.0',
frontend: {
phases: {
preBuild: {
commands: ['npm ci'],
},
build: {
commands: ['npm run build'],
},
},
artifacts: {
baseDirectory: '.next',
files: ['**/*'],
},
cache: {
paths: ['node_modules/**/*'],
},
},
}),
});
// Add the main branch to the Amplify app
amplifyApp.addBranch('main');
When I push my code a deployment starts, but it fails on the provisioning step with the following error:
[ERROR]: !!! Unable to assume specified IAM Role. Please ensure the selected IAM Role has sufficient permissions and the Trust Relationship is configured correctly.
[INFO]: # Starting environment caching...
[INFO]: # Environment caching completed
Would be extremely thankful for any help. I've read through previous related issues but was unable to resolve this.
Reproduction steps
- Create a basic NextJS app
- Initiate CDK in the app with the TS stack provided above
- Run
cdk synth
,cdk bootstrap
andcdk deploy
- Push a change to main
- The deployment should fail
Metadata
Metadata
Assignees
Labels
hostingIssue related to Amplify HostingIssue related to Amplify Hostingpending-community-responseIssue is pending a response from the author or communityIssue is pending a response from the author or communityquestionQuestion or confusion about some aspect of the productQuestion or confusion about some aspect of the product