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

Deploying to production environment not working as expected #785

Open
1 of 3 tasks
rinukkusu opened this issue Nov 27, 2023 · 3 comments
Open
1 of 3 tasks

Deploying to production environment not working as expected #785

rinukkusu opened this issue Nov 27, 2023 · 3 comments

Comments

@rinukkusu
Copy link

rinukkusu commented Nov 27, 2023

Before filing this issue, please ensure you're using the latest CLI by running swa --version and comparing to the latest version on npm.

Are you accessing the CLI from the default port :4280 ?

  • No, I am using a different port number (--port) and accessing the CLI from that port
  • Yes, I am accessing the CLI from port :4280
  • Yes, default port, but I'm not using the port at all

Make sure you are accessing the URL printed in the console when running swa start!

ℹ️ NOTE: Make sure to enable debug logs when running any swa commands using --verbose=silly

Describe the bug

  • ✅ Setting no environment with the --env option deploys to preview environment. That's fine.
  • ❌ Setting environment to "Production" deploys to preview environment called "production". NOT fine.
  • ❌ Setting environment to "production" deploys to preview environment called "production". NOT fine.
  • ✅ Only setting environment to "prod" deploys to the production environment. That's fine, but not documented.

To Reproduce
Steps to reproduce the behavior:

  1. Go to your app folder
  2. Type in command 'swa deploy ./dist --env production'
  3. It deploys without problem, but to a preview environment called "production"

Expected behavior
Looking at the documentation, I expect that setting the environment to "production" deploys the app to the production environment. I also expect that setting the environment to "Production" produces the same outcome (see #518). I'm fine with using "prod" as environment option, but this should be clearly documented then, otherwise I consider this is a bug, that cost me many hours debugging.

Screenshots
See screenshots in #518

Desktop (please complete the following information):

  • OS: Docker image node
  • Version: lts-bullseye
@rinukkusu rinukkusu changed the title Deploying to production environment not working correctly Deploying to production environment not working as expected Nov 27, 2023
@cjk7989
Copy link
Contributor

cjk7989 commented Dec 13, 2023

Hi @rinukkusu, I tried to reproduce the issue with the following commands:

  • swa deploy --env production
  • swa deploy --env Production
  • swa deploy --env myEnv

The first and second commands deployed to: purple-mud-05975d71e.3.azurestaticapps.net
And the third one deployed to (a preview environment): purple-mud-05975d71e-myenv.westus2.3.azurestaticapps.net

So could you check if your cli version is 1.1.6 (the latest release)? If so, could you kindly provide the logs? Thanks!

@avh01
Copy link

avh01 commented May 10, 2024

In case it helps someone in the future. I experienced a similar issue on both swa cli 1.1.6 and 1.1.7 and the issue was caused by an environmental variable named DEPLOYMENT_ENVIRONMENT that was set to production. That env variable was causing the pipeline to deploy to a preview environment called production. Removing the env variable fixed the issue for me and now I can deploy to production with the --env production flag.

@avh01
Copy link

avh01 commented May 10, 2024

When any value is set for DEPLOYMENT_ENVIRONMENT including production or Production, swa deploy seems to ignore the --env option and deploy to a preview environment named to match the DEPLOYMENT_ENVIRONMENT value.
I'm not sure if this is expected or not, maybe someone can point me to the correct documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants