Bitbucket upload file ver 0.3.3 getting an error, pipe
Asked by Scott Remiger:

Using the atlassian/bitbucket-upload-file:0.3.3 Pipe  
I am getting the following message.

```
Digest: sha256:3a2820e78495f1d6dfba7daea656cc647dee5a91d089c253bdd0c2e472af179f
Status: Downloaded newer image for bitbucketpipelines/bitbucket-upload-file:0.3.3
DEBUG: Starting new HTTPS connection (1): bitbucket.org:443
DEBUG: https://bitbucket.org:443 "GET /bitbucketpipelines/official-pipes/raw/master/pipes.prod.json HTTP/1.1" 200 None
INFO: Executing the pipe...
INFO: Start uploading 1 files ['frontend/build/AR5-104.zip']...
DEBUG: Starting new HTTPS connection (1): api.bitbucket.org:443
DEBUG: https://api.bitbucket.org:443 "POST /2.0/repositories/ClientName/ProjectName/downloads HTTP/1.1" 401 469
? API request failed with status 401. Check your username and app password and try again.
```

Using the atlassian/bitbucket-upload-file:0.1.2 Pipe  
I am getting the following message.

```
Digest: sha256:78d115fed575fc845c33f7048178f62ef7978670be3ef4e81a9343a3d7349310
Status: Downloaded newer image for bitbucketpipelines/bitbucket-upload-file:0.1.2
DEBUG: Starting new HTTPS connection (1): bitbucket.org:443
DEBUG: https://bitbucket.org:443 "GET /atlassian/bitbucket-upload-file/raw/master/pipe.yml HTTP/1.1" 200 441
WARNING: New version available: atlassian/bitbucket-upload-file '0.1.2' to '0.3.3'
INFO: Executing the pipe...
? File frontend/build/AR5*.zip doesn't exist.
```

This is my step

```
- step:
name: Upload Zip File to download location
script:
- pipe: atlassian/bitbucket-upload-file:0.X.X
variables:
BITBUCKET_USERNAME: $BITBUCKET_USERNAME
BITBUCKET_APP_PASSWORD: $BITBUCKET_APP_PASSWORD
FILENAME: "frontend/build/AR5*.zip"
ACCOUNT: $BITBUCKET_REPO_OWNER
REPOSITORY: $BITBUCKET_REPO_SLUG
DEBUG: "True"
```

I filled out the password in the area.  
<https://bitbucket.org/account/settings/app-passwords/new>  
By checking all the boxes

My requirement is that I upload a file actually called to the download area.

```
frontend/build/AR5-$$BITBUCKET_BUILD_NUMBER.zip
```

This is an artifact from a previous step.


Answers:
author: Theodora Boudale
body: Hi Scott,

We recommend using the latest version of the pipe, which is 0.3.3 at the moment, as version 0.1.2 is quite old.

When using the latest version, the error you are getting is the following:

```
API request failed with status 401. Check your username and app password and try again
```

This means that there is an issue with the credentials you are providing, either $BITBUCKET_USERNAME or $BITBUCKET_APP_PASSWORD.

You mentioned that you generated an app password via this page <https://bitbucket.org/account/settings/app-passwords/new>

**(1)** The variable $BITBUCKET_USERNAME should have the username of the Bitbucket account you generated this app password for, and not the label for the app password.

The username is listed here after you log in to the account: <https://bitbucket.org/account/settings/>.

Are you using this username in the value of $BITBUCKET_USERNAME ?

**(2)** If you are using the correct username, I would suggest recreating the variables $BITBUCKET_USERNAME and $BITBUCKET_APP_PASSWORD, and before you give them a value, copy-paste their value in a text editor, to ensure that no additional characters are added to their values accidentally.

Please feel free to let me know how it goes.

Kind regards,  
Theodora

comments: author: Scott Remiger
body: Wrong, user name that fixed it.


author: Theodora Boudale
body: That's good to hear Scott, thank you for the update.

Please feel free to reach out if you ever need anything else!


Tags: bitbucket-pipelines

cloud