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

Recommend adding @aws section to .arc file #156

Closed
wildcat63 opened this issue May 25, 2022 · 3 comments
Closed

Recommend adding @aws section to .arc file #156

wildcat63 opened this issue May 25, 2022 · 3 comments
Assignees

Comments

@wildcat63
Copy link

What version of Remix are you using?

1.5.1

Steps to Reproduce

  1. have multiple AWS profiles locally (i.e. not just a single "default" profile)
  2. npx create-remix --template remix-run/grunge-stack
  3. add required secrets in GitHub actions for a non-default AWS profile
  4. create the "npx arc env --add --env staging ARC_APP_SECRET $(openssl rand -hex 32)" set of variables in architect
  5. git push to run the GitHub action

Expected Behavior

success

Actual Behavior

missing SESSION_SECRET error in lambda function

error occurs in line 7 of session.server.ts: invariant(process.env.SESSION_SECRET, "SESSION_SECRET must be set");

Note that this will be fixed if the .arc file has an @aws section

Example:
@aws
region us-east-2
profile default

With that entry in the .arc file, it would be clear to a user what needs to be changed (i.e. change default to the desired profile)

Documentation could be amended to suggest that is where to change the region and profile if needed.

@jonparker
Copy link

Sorry, I'm very new to Remix but I am interested in getting it running with AWS & DynamoDB.

Do you mean the instructions for step 4 should be something like this:

If you want to deploy to staging with a non-default AWS profile run:

export AWS_PROFILE=nonedefaultprofile
npx arc env --add --env staging ARC_APP_SECRET $(openssl rand -hex 32)
npx arc env --add --env staging SESSION_SECRET $(openssl rand -hex 32)

otherwise run:

npx arc env --add --env staging ARC_APP_SECRET $(openssl rand -hex 32)
npx arc env --add --env staging SESSION_SECRET $(openssl rand -hex 32)

@wildcat63
Copy link
Author

wildcat63 commented May 25, 2022

Sorry - follow the instructions in the README.md file to the letter. However, if you are deploying (either directly or with GitHub Actions) and you are deploying to a different profile, then you need an @aws section in your app.arc file that should look like the one in my comment with the exception of the profile line not being "profile default" but "profile my-other-aws-config-profile". Note that this only works if your aws config has multiple profiles in it. I wouldn't recommend using an AWS_PROFILE env var. That's too easy to miss from time to time. I recommend the @aws section in the .arc file instead. Hope that helps.

@jonparker
Copy link

Ok, thanks. I looked in https://github.com/remix-run/grunge-stack and couldn't see any app.arc file so I'm guessing it is generated by one of the setup steps.
I've never used Architect so will have to do a bit more reading to get my head around what it is doing.

@MichaelDeBoey MichaelDeBoey transferred this issue from remix-run/remix Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Closed
Development

No branches or pull requests

3 participants