DEV Community


Discussion on: Branch Based Deployment Strategies with AWS Amplify Console

lhousehold profile image
Luke Household • Edited

Hey Kurtis! Good article. I'm wondering one thing about the workflow you've described. Everything works well for me except for one thing. When adding authentication, the withAuthenticator tool is awesome, but I see it requires the following line:

import awsExports from "./src/aws-exports"

This works great locally and when I add amplify hosting with the cli. But when I connect my git repo to Amplify Console and run it, it says aws-exports.js cannot be found. This is of course because Amplify recommends that aws-exports.js should be in the .gitignore file.

How should I program my app so that either aws-exports.js is available to the Amplify Console, or the frontend does not need to import aws-exports.js to add authentication to the frontend? Since your app builds perfectly I figure you would know what is missing.

Thanks for sharing your expertise!

theworstdev profile image
Kurt Kemple Author

It should be generated for you when the backend is deployed! It's interesting to here that the Console is asking for the file. I would need to see the steps taken when creating the project as I haven't seen that issue before.

riznob profile image
Rob Anderson

You need to add a backed section to your amplify.yml build spec...
- amplifyPush --simple

I also needed to edit my build image settings in Amplify console to add a package version override so that the latest version of amplify was being used for builds via Amplify console. I hope this helps.