Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Passed variables to npm script are empty

senad87 I'm New Here Nov 12, 2021
I have the following in the bitbucket-pipeline.yml:

- npm install
- API_URL=$API_URL npm run build

and unsecured deployment variable API_URL that has value

console.log(process.env.API_URL)  show nothing in the pipeline log when build is started.

When using hardcoded url everything works as expected:

- npm install
- API_URL= npm run build

Not sure what am I doing wrong?

Any help is much appreciated.

1 answer

0 votes
Syahrul Atlassian Team Jan 09, 2022

Hi @senad87 

Welcome to the community!

Could you try to add echo on the variable before the steps that you use to call it to verify that pipeline is correctly showing the variable as the following example:

             - echo "$API_URL"

 This should create an echo output of the variable in the pipeline build where you can use to verify if the variable is correctly showing the output you configure as below example:

Screenshot 2022-01-10 at 1.18.37 PM.png

If it's not showing any echo output or the output is different from what you expected then the variable may be using a secure variable or you have a conflict variable that you may have configured in the deployment variable or the workspace variable.

I hope this helps.


Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

⭐ Calling all Bitbucket and DevOps experts: Special showcase opportunity ⭐

Hi, Bitbucket community! Are you a DevOps practitioner (or know one in your network)? Do you have DevOps tips, tricks, or learnings you'd like to share with the community? If so, we'd love to hea...

1,483 views 4 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you