1

I followed the instructions on https://learn.microsoft.com/en-us/azure/static-web-apps/bitbucket?tabs=vanilla-javascript to setup a static web app and hook it up to a bitbucket repository I created (I did not import any code from GitHub as indicated in the instructions).

Now, I created a directory structure that looks like:

├── app │    
|       └── index.html  
├── bitbucket-pipelines.yml  
└── README.md

and put the following in my bitbucket-pipelines.yml:

pipelines:
  branches:
    main:
      - step:
          name: Deploy to test
          deployment: test
          script:
            - chown -R 165536:165536 $BITBUCKET_CLONE_DIR
          pipe: microsoft/azure-static-web-apps-deploy:main
          variables:
            APP_LOCATION: '/app'
            OUTPUT_LOCATION: '/'
            API_TOKEN: $deployment_token

yet, the pipeline keeps failing with the following error:

App Directory Location: '/app' is invalid. Could not detect this directory. Please verify your deployment configuration file reflects your repository structure.

I tried to remove the leading slash but then the error simply changes to:

App Directory Location: 'app' is invalid. Could not detect this directory. Please verify your deployment configuration file reflects your repository structure.

I tried the same with a trailing slash, also:

App Directory Location: 'app/' is invalid. Could not detect this directory. Please verify your deployment configuration file reflects your repository structure.

and when I click on the dynamic link in Azure, I just get the default page:

Congratulations on your new site!Your site will be ready soon—please check back later. Recommended next steps:

the contents of my app/index.html are just:

<h1>
    HELLO WORLD!
</h1>

What's going on why does the pipeline not succeed?

I updated and reconfirmed the deployment_token is correct and updated the bitbucket-pipelines.yml to look like:

ipelines:
  branches:
   main:
    - step: 
        name: Deploy to test
        deployment: test
        script:
          - chown -R 165536:165536 $BITBUCKET_CLONE_DIR
          - ls -la $BITBUCKET_CLONE_DIR/app
          - pipe: microsoft/azure-static-web-apps-deploy:main
            variables:
                APP_LOCATION: 'app/'
                OUTPUT_LOCATION: '/'
                API_TOKEN: $deployment_token

but still received the following error (and I don't see any outut from the added ls -la command - which might be where the problem lies):

...
f1a297e30279: Pull complete
6f6d70254289: Pull complete
Digest: sha256:8cb95b83eb105a678a6a3ab885a4c1ffc90d5441919a7a45b1bfdff9b1c5925d
Status: Downloaded newer image for staticwebapps.azurecr.io/bitbucket-deploy:stable
DeploymentId: dbdeb19c-ebcd-4588-966d-52f321b53407
Try to validate location at: '/bin/staticsites/app'.
App Directory Location: 'app/' is invalid. Could not detect this directory. Please verify your deployment configuration file reflects your repository structure.
MisdeBug
  • 11
  • 3

2 Answers2

0

IMO, in APP_LOCATION, app should be without a leading slash.

APP_LOCATION: 'app'
OUTPUT_LOCATION: '/'
YassineLbk
  • 160
  • 7
0

I eventually got it going with:

          script:
            - chown -R 165536:165536 $BITBUCKET_CLONE_DIR
            - echo `pwd`
            - ls -la
            - pipe: microsoft/azure-static-web-apps-deploy:main
              variables:
                APP_LOCATION: '$BITBUCKET_CLONE_DIR/src' 
                OUTPUT_LOCATION: '$BITBUCKET_CLONE_DIR/src'
                API_TOKEN: $deployment_token

created a src/ directory in root and created a src/index.html file which seemed to work out just fine! Thanks for all your inputs!

MisdeBug
  • 11
  • 3