Azure / azure-cli

Azure Command-Line Interface
MIT License
3.96k stars 2.94k forks source link

Unable to deploy Frontend React App v20+ on Azure Static Web App #29456

Open ahashmi10 opened 1 month ago

ahashmi10 commented 1 month ago

Describe the bug

I have a pipeline in bitbucket in which I am building a react v20 app to be deployed on Azure Static Web App. Although the code compiles successfully but when we install Azure CLI usinf NPM i command and than try to deploy the compiled artifacts to the SWA using the deployment token we face an error.

Related command

development:
  - step:
      deployment: devBuild      
      name: 'Build'
      caches:
        - my-node-cache
      script:
        - npm i --legacy-peer-deps
        - export NODE_OPTIONS="--max-old-space-size=8192"
        - npm run build
        - npm i -g @azure/static-web-apps-cli
        - swa deploy --deployment-token=$dev_deployment_token  --env=production

Errors

swa deploy --deployment-token=$dev_deployment_token --env=production

<1s

Node.js v20.2.0

Issue script & Debug output

N/A

Expected behavior

N?A

Environment Summary

N/A

Additional context

Please help me in resolving this issue as my new build is dependent on it

yonzhan commented 1 month ago

Thank you for opening this issue, we will look into it.

yonzhan commented 1 month ago

Which CLI command is this issue related to?

ahashmi10 commented 1 month ago

Which CLI command is this issue related to?

swa deploy --deployment-token=$dev_deployment_token --env=production

yonzhan commented 1 month ago

Above is not Azure CLI command.

ahashmi10 commented 1 month ago

@yonzhan This is what I came across "The error message you're seeing is due to an incompatibility between the code in the @azure/static-web-apps-cli package and the version of Node.js you are using (v20.2.0). The with {type: 'json'} syntax is not supported in Node.js v20.2.0."

what's your take on this ?