Problem to deploy Azure static web apps from Bitbucket

Infra Account 0 Reputation points
2023-11-16T10:14:40.54+00:00

Hi everyone,

I made a bitbucket-pipelines.yml to deploy a React app to Azure static web apps from Bitbucket and it fail when try to get a variable API_TOKEN from $deployment_token added previously.

I made several test even paste directly the value and it not work.

Other users report to the same issue:

https://github.com/Azure/static-web-apps/issues/1314

https://github.com/Azure/static-web-apps/issues/1309

I contacted the Bitbuket support and they responded :

This pipe supported by Microsoft team, and seems like they stopped to maintain it:

This sample is provided “as is” and is not supported. Likewise, no commitments are made as to its longevity or maintenance. To discuss this sample with other users, please visit the Azure DevOps Services section of the Microsoft Developer Community

Here my pipelines:

image: node:18

pipelines:
  default:
   - step:
       name: Build
       caches:
         - node
       script:
         - npm install
         - npm run lint
         - npm run build
   - step:
     name: Deploy to baamer.treegram.fr
     deployment: develop
     script:
       - pipe: microsoft/azure-static-web-apps-deploy:main
         variables:
           APP_LOCATION: '$BITBUCKET_CLONE_DIR'
           OUTPUT_LOCATION: '$BITBUCKET_CLONE_DIR/dist'
           SKIP_APP_BUILD: 'true'
           API_TOKEN: $deployment_token
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
995 questions
{count} votes

1 answer

Sort by: Most helpful
  1. SnehaAgrawal-MSFT 21,926 Reputation points
    2023-11-21T06:45:51.5266667+00:00

    @Infra Account

    This happens in the very beginning of the swa deployment, which will occur if fail to check one of:

    1. The length of deployment_token is less than the legal value.
    2. The parsed characters stands for the slice or region in the token are illegal.

    The reporting of this error is even earlier than checking if the token equals to the one shown in portal.

    Could you please try below steps-

    1. Follow Reset deployment tokens in Azure Static Web Apps | Microsoft Learn to reset their token, this will ensure their token meet the above conditions.
    2. Then manually write the new token to the settings of their github repo or gitlab, this will ensure the action actually read the right token. Hope this helps.

    Let us know if you have any further issue here.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.