amplifyrc
AmplifyRC Configuration Guide: Fix Common Issues & Set Up Your Project Right
Key Takeaways
- What is AmplifyRC? A JSON/YAML config file that stores Amplify project settings including auth providers, API endpoints, storage buckets, and environment variables.
- Most common problem: Missing or misconfigured amplifyrc causes auth flow failures, API connection errors, and deployment breakdowns.
- Quick fix: Run
amplify configure projector manually edit.amplifyrcin your project root with correct service mappings. - Best practice: Version control your amplifyrc file — it should track alongside your source code for reproducible deployments.
What Is AmplifyRC and Why Does It Matter?
The Central Configuration File for Amplify Projects
The amplifyrc (or .amplifyrc) file is the backbone configuration for any AWS Amplify project. Located in your project root, it tells the Amplify CLI and runtime how to wire together your authentication, storage, APIs, hosting, and analytics.
Without a properly configured amplifyrc:
- Auth flows will fail to redirect correctly
- API calls return 403/404 errors
- Storage operations cannot find their buckets
- Build pipelines break in CI/CD
Where Is the AmplifyRC File Located?
There are typically two configuration surfaces:
| File | Location | Purpose | Editable? |
|---|---|---|---|
.amplifyrc |
Project root | CLI project settings, backend config | Yes — recommended via CLI |
aws-exports.js |
src/aws-exports.js |
Client-side runtime config | Auto-generated — do not edit |
amplify.yml |
Project root | Build pipeline / CI-CD settings | Yes — for pipeline customization |
amplify/configuration.json |
.amplify/ directory |
Internal Amplify state | No — managed by CLI |
AmplifyRC vs aws-exports.js: Understanding the Difference
Confusion between these two files causes the majority of Amplify setup errors. The .amplifyrc controls backend provisioning — what resources get created in AWS. The aws-exports.js is the client-side consumption — what your app reads at runtime to connect to those resources.
Always run amplify pull after changing .amplifyrc to regenerate aws-exports.js. Never edit aws-exports.js manually.
Troubleshooting AmplifyRC: The 5 Most Common Problems
Problem 1: Auth Flow Fails After Deployment
Symptoms: Login redirects to a blank page, OAuth callbacks fail, or users see "Invalid client" errors.
Root cause: The amplifyrc is missing or has incorrect auth provider mappings. This commonly happens when migrating between environments or after a team member updated amplifyrc without pulling changes.
Solution steps:
- Check
.amplifyrcfor theauthsection — verifyserviceis set toCognito - Run
amplify pull --appId YOUR_APP_ID --envName dev - Confirm OAuth redirect URIs match in both amplifyrc and the AWS Cognito console
- Regenerate exports:
npx amplify-codegen
Problem 2: Storage Operations Return Access Denied
Symptoms: File uploads fail with 403 errors. S3 bucket policies appear correct but operations still fail.
Root cause: The storage section in .amplifyrc does not match the actual bucket permissions, or the aws-exports.js is stale after an amplify push.
Solution checklist:
- [ ] Verify
bucketNamein .amplifyrc matches the deployed resource - [ ] Check
regionsetting matches your bucket region - [ ] Run
amplify pullto refresh aws-exports.js - [ ] Confirm IAM roles in
amplify/backend/auth/have correct bucket access
Problem 3: API Endpoint Returns 502 or Connection Refused
Symptoms: GraphQL or REST API calls fail immediately after deployment. CloudFront returns 502 errors.
Root cause: The api section in amplifyrc has incorrect endpoint URLs or the API Gateway is not fully deployed yet.
Solution steps:
- Run
amplify statusto check API deployment state - Verify
endpointTypein .amplifyrc is set correctly (GraphQLorREST) - Check that
graphqlEndpointin aws-exports.js matches the deployed API Gateway URL - If using Lambda functions, ensure function timeouts in
amplify.ymlare adequate
Problem 4: CI/CD Pipeline Fails on Amplify Build
Symptoms: Amplify Console reports build failures. Logs show "amplify.yml not found" or "configuration conflict".
Root cause: Missing or malformed amplify.yml, or the .amplifyrc references backends that do not exist in the current branch.
Diagnostic table:
| Error Message | Cause | Fix |
|---|---|---|
| "amplify.yml not found" | File missing from repository root | Create amplify.yml with basic build commands |
| "Backend config mismatch" | .amplifyrc references deleted resources | Run amplify pull and remove stale backends |
| "Code generation failed" | Schema drift between amplifyrc and actual backend | Run amplify codegen models locally first |
| "Auth configuration error" | OAuth settings changed but pipeline not updated | Update amplify.yml environment variables for auth |
Problem 5: Local Dev Server Cannot Find Amplify Config
Symptoms: npm start works but Amplify imports throw "Cannot find module aws-exports" errors at runtime.
Root cause: The aws-exports.js file is not in the expected path, or the project was set up in