amplify-hosting
amplify-hosting copied to clipboard
Amplify Console Host Web App flow not respecting the backend env name provided
Before opening, please confirm:
- [X] I have checked to see if my question is addressed in the FAQ.
- [X] I have searched for duplicate or closed issues.
- [X] I have read the guide for submitting bug reports.
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.
App Id
NEW_APP
AWS Region
us-east-1
Amplify Hosting feature
Backend environments, Console, Deployments
Frontend framework
React
Next.js version
N/A
Next.js router
N/A
Describe the bug
Amplify console let's you provide the name for the new backend environment while hosting the web app. It used to create the backend env with provided name and link with the frontend for CI/CD fullstack deployment. However, currently it is either using the name of branch when possible or randomly generates a name.
Expected behavior
Backend environment should be created with the name provided and that should get linked to the frontend
Reproduction steps
- Fork this repo or setup any fullstack repo without amplify.yml file (so that default behaviour gets kicked in) in github (less likely to be provider dependent).
- Open Amplify console => New App => Host Web App.
- Select the repo, branch etc.
- Select create backend environment option and provide the name which is different from branch name & complete steps.
- Wait for deployment to finish.
- Check the backend env name
Build Settings
=== Note: this is the auto generated version itself
version: 1
backend:
phases:
build:
commands:
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- yarn install
build:
commands:
- yarn run build
artifacts:
baseDirectory: build
files:
- '**/*'
cache:
paths:
- node_modules/**/*
Log output
# Put your logs below this line
N/A
Additional information
Repo URL: https://github.com/gorbinphilip/react-amplify-sample Recording: https://github.com/aws-amplify/amplify-hosting/assets/41995531/39b8e7f9-98fe-4169-af93-5d9519467396 Screenshot: https://github.com/aws-amplify/amplify-hosting/assets/41995531/bfe8b30f-7300-4020-a69e-2da2a4f49864
Feel free to skip if clock is ticking too fast.
At least this was working while amplifyPush helper script was around. Which I still continue using by manually adding to the existing deployments running cli v5.6 out of fear (keeping some magical commands in that script is scary as well, but boy do I have a choice).
Well, the reason for that is because amplify team decided to remove that out of the blue and backend builds were no longer happening. So we had to hack (apologies for the bragging but that was really unprofessional). From docs, I see that now amplify hosting scans for the presence of amplifyPush
command and automatically manages backend deployment for backward compatibility.
Now at present, while I'm scratching head exploring the options to migrate to latest cli and get rid of hacks, there comes this env name trouble. Now I am wondering what would be the effect of getting rid of the helper script from existing deployments and just put the magical word amplifyPush --simple
. Well, who knows if amplify would randomly setup a new backend env :fearful: and connect that with the frontend.
Some might ask, why not just try and see for yourself. Well, for my luck nodejs12.x
is no longer supported by AWS lambda which is magically used by cli 5.6
for different categories and that prevents me from spawning new envs to play with. I'll give a shot with the new repo and update later on this one.
Update:
Looks like the issue is caused from console not injecting the env variable required: USER_BRANCH
Works as expected if this is manually added. This used to get added automatically for the branch earlier based on the provided value.
Hi @gorbinphilip 👋 , thanks for raising this issue and for sharing detailed reproduction steps.
I was able to reproduce this behavior and I am going to mark this as a bug. Additionally, you've correctly mentioned that the issue seems to be related to the console not setting the USER_BRANCH
environment variable with the backend environment name that is passed during the app creation workflow.
The workaround for now is to manually set the USER_BRANCH
environment variable to the backend environment name that is being used during the app creation workflow. Kindly refer to the attached screenshot:
Any update of this. Has the website been updated or must we still enter user branch as environment variable?
Fast forwarding to 2024, AWS amplify console has reached to a stage where it doesn't respect any of the build package overrides. Whatever you configure cli version, node version etc.. it just installs whatever it feels like. Currently when requesting, node 18
, amplify cli 12.11
with Amazon Linux 2023, console goes ahead and configures node 14, amplify 12.12.
https://discord.com/channels/705853757799399426/1239554630153670697/1239554630153670697
Have never used a service from AWS that's this unreliable. I do appreciate that most of the components are open source and iterated in fast pace, but that doesn't justify breaking core parts. Not to mention the fact the idea was to set a project up and running without head scratching too much about infra.
Apologies once again for the rant here because AWS doesn't have a provision to report or reach out without a paid developer plan. This probably has nothing do with open source side of amplify but just AWS
Yes, and I think the new design of the new amplify console is much less intuit. And still there is no button for manual build, you must enable CI and push a commit to build.
The new UI also duplicate global build settings as branch environments variables. So if after the first deployment and want change a global build environment variable, you must also change the variable for all build branch.
Are you still experiencing this issue?
I've used the workaround and not tried to deploy without it. If two deployments/apps use the same backend then corruption will occur. I think this was a major bug, and shocked that AWS amplify had not fixed it
tor. 27. juni 2024, 18:12 skrev Matt Auerbach @.***>:
Are you still experiencing this issue?
— Reply to this email directly, view it on GitHub https://github.com/aws-amplify/amplify-hosting/issues/3745#issuecomment-2195116394, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUXMIROB2IZARERS6HTSPNLZJQ2VLAVCNFSM6AAAAAA5V6JA4OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJVGEYTMMZZGQ . You are receiving this because you commented.Message ID: @.***>