My AWS Amplify application has been working perfectly for months, but now I’m facing a strange issue during the build process. The app uses authentication as its only backend service.
When I try to build now, I keep getting this error:
Module not found: Error: Can't resolve '@/aws-exports' in '/codebuild/output/src987654321/src/my-app/src'
Looking at the build logs, I notice that the backend detection is failing:
## Starting Backend Build
## Checking for associated backend environment...
## No backend environment association found, continuing...
This is weird because previous builds always found the backend successfully.
I already tried these steps:
- Double checked that CI/CD is enabled for full-stack deployments and the backend environment settings are correct
- Executed
amplify pull --appId <my-app-id> --envName <backend-env>
command which returned that everything is current with no changes needed - Verified that my app has an IAM role with “AdministratorAccess-Amplify” policy attached
I also noticed a You are in 'detached HEAD' state.
message in the logs, but I tested that specific commit locally and it works fine.
The last update I made was just a simple bug fix, nothing that should affect the backend connection.
How can I debug this issue and get my backend detection working again?