<p>I eventually got it going with:</p>
<pre><code>          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

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

CC BY-SA 4.0
2024-08-30T09:57:11.500Z
2024-08-30T09:57:11.500Z
MisdeBug
<p>IMO, in <code>APP_LOCATION</code>, <code>app</code> should be without a leading slash.</p>
<pre><code>APP_LOCATION: 'app'
OUTPUT_LOCATION: '/'
</code></pre>

CC BY-SA 4.0
2024-08-29T09:49:16.917Z
Thanks or the response, I tried that but that didn't work either. I updated the original post above
MisdeBug
CC BY-SA 4.0
2024-08-29T09:55:25.913Z
Add a "- ls -la $BITBUCKET_CLONE_DIR/app" under show to check if a permission issue.
Make sure your deployment token is correct.
YassineLbk
CC BY-SA 4.0
2024-08-29T11:07:01.803Z
Thanks for the response! I tried that and updated the post above.... unfortunately, it doesn't appear to get to even executing any of the commands in the container
MisdeBug
CC BY-SA 4.0
2024-08-29T22:21:29.747Z
@MisdeBug if you follow the doc, the safest way to do it is « APP_LOCATION: $BITBUCKET_CLONE_DIR/app«
YassineLbk
CC BY-SA 4.0
2024-08-28T22:08:05.487Z
2024-08-28T22:08:05.487Z
YassineLbk
<p>I followed the instructions on <code>https://learn.microsoft.com/en-us/azure/static-web-apps/bitbucket?tabs=vanilla-javascript</code> 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).</p>
<p>Now, I created a directory structure that looks like:</p>
<pre><code>├── app │    
|       └── index.html  
├── bitbucket-pipelines.yml  
└── README.md
</code></pre>
<p>and put the following in my <code>bitbucket-pipelines.yml</code>:</p>
<pre><code>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

</code></pre>
<p>yet, the pipeline keeps failing with the following error:</p>
<pre><code>App Directory Location: '/app' is invalid. Could not detect this directory. Please verify your deployment configuration file reflects your repository structure.
</code></pre>
<p>I tried to remove the leading slash but then the error simply changes to:</p>
<pre><code>App Directory Location: 'app' is invalid. Could not detect this directory. Please verify your deployment configuration file reflects your repository structure.
</code></pre>
<p>I tried the same with a trailing slash, also:</p>
<pre><code>App Directory Location: 'app/' is invalid. Could not detect this directory. Please verify your deployment configuration file reflects your repository structure.
</code></pre>
<p>and when I click on the dynamic link in Azure, I just get the default page:</p>
<p><strong>Congratulations on your new site!Your site will be ready soon—please check back later.
Recommended next steps:</strong></p>
<p>the contents of my app/index.html are just:</p>
<pre><code>&lt;h1&gt;
    HELLO WORLD!
&lt;/h1&gt;
</code></pre>
<p>What's going on why does the pipeline not succeed?</p>
<p>I updated and reconfirmed the <code>deployment_token</code> is correct and updated the <code>bitbucket-pipelines.yml</code> to look like:</p>
<pre><code>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
</code></pre>
<p>but still received the following error (and I don't see any outut from the added <code>ls -la</code> command - which might be where the problem lies):</p>
<pre><code>...
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.
</code></pre>

<azure><bitbucket-pipelines>
Unable to connect static pages web app to bitbucket account
MisdeBug
# Unable to connect static pages web app to bitbucket account

(Asked by: username_0 on 2024-08-28)

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:

    HELLO WORLD!


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.

**Tags:** azure, bitbucket-pipelines


---

## 2 answers

### Answer by username_0 on 2024-08-30. Score: 0 | Accepted answer

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!


---

### Answer by username_1 on 2024-08-28. Score: 0

IMO, in APP_LOCATION, app should be without a leading slash.
APP_LOCATION: 'app'
OUTPUT_LOCATION: '/'

> **Comments:**
> **username_0**: Thanks or the response, I tried that but that didn't work either. I updated the original post above  
> **username_1**: Add a "- ls -la $BITBUCKET_CLONE_DIR/app" under show to check if a permission issue. Make sure your deployment token is correct.  
> **username_0**: Thanks for the response! I tried that and updated the post above.... unfortunately, it doesn't appear to get to even executing any of the commands in the container  
> **username_1**: @username_0 if you follow the doc, the safest way to do it is « APP_LOCATION: $BITBUCKET_CLONE_DIR/app«  

---

