#✅ - Angular and Gen2

1 messages · Page 1 of 1 (latest)

icy tiger
#

Has anyone got Gen2 to work with Angular? I gave up on the AWS template. Trying to deploy, there was an error about Node versions. I tried to specify the Node version Angular wanted -- but without success.

Next I tried to start from scratch but when I try to run npx ampx sandbox I get an error about AccessDeniedException: User -- even though I was able to run sandboxes for React and NextJS with Gen2.

The error is...

gaunt swallow
#

I am running successfully with Angular. I created a new Gen2 project rather than trying to update an existing project. And it did take me a bit to get the AWS Profiles in place, but I'm successfully using AWS SSO profiles.

I have a super clean AWS instance, too. My profile is using stock standard admin level privileges.

icy tiger
#

Well... at least I know now that it's just personal 😦

icy tiger
#

Okay... now I've determined that it's not just an Angular thing. I get the same problem if I try to create any new sandbox... for projects of any kind. I guess that's not surprising: there's no reason it should be Angular-specific.

icy tiger
#

I figured it out -- sort of. npx ampx sandbox was using an obsolete default profile. Even though the user doesn't appear in ~/.aws/config. But if I use a --profile option I can get it to work.

steady flame
#

👋 do you have a [default] profile configured in both ~/.aws/credentials and ~/.aws/config?

icy tiger
icy tiger
gaunt swallow
#

Sorry for the late reply. I didn't run into version issues, but I updated everything before starting. I am using "@angular/core": "^17.0.2" and node --version reports v20.13.1.

For authentication, I am setting AWS_PROFILE in the environment (though you can set this with npx ampx configure profile, too) , and using "aws sso login". Getting this to work smoothly was a chore. See https://github.com/aws-amplify/amplify-cli/issues/4488, the last comment of which (as of a few weeks ago) is my own and references my configuration - perhaps the same thing that you ran into with the stale credentials.

#

A bit more detail about my config.

At this point, I run

export AWS_PROFILE=bilbo-admin

then run

aws sso login

at some point before running my npx ampx sandbox command.

and my config file looks like this:

`[profile bilbo-admin]
sso_session = amplify-sso
sso_account_id = 123456
sso_role_name = AdministratorAccess
region = us-east-1
output = json
credential_process = aws configure export-credentials --profile bilbo-admin

[sso-session amplify-sso]
sso_start_url = https://d-123456.awsapps.com/start
sso_region = us-east-1
sso_registration_scopes = sso:account:access`

the magic in credential_process is that it sets the right values from the command in the environment whenever a AWS utility tries to use that profile. Apparently you can put the aws sso login command there, too, which is pretty odd given that the docs say that this expects structured json output which that command doesn't give you. Just more magic...

Note with this setup I don't need to directly mess with the credentials file at all.

Finally, the ./amplify/.config directory referenced in the github issue above doesn't exist in my current project. This might be a carryover from the earlier version.

light timberBOT
#

✅ - Angular and Gen2

#

Marked as solved.