# Serverless Deploy with Bitbucket pipelines

**URL:** <https://forum.serverless.com/t/serverless-deploy-with-bitbucket-pipelines/20045>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [March 27, 2024, 4:40pm UTC](https://forum.serverless.com/t/serverless-deploy-with-bitbucket-pipelines/20045 "2024-03-27T16:40:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dfoley84](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/dfoley84/32/7861_2.png) [@dfoley84](https://forum.serverless.com/u/dfoley84)\
**Post date:** [March 27, 2024, 4:40pm UTC](https://forum.serverless.com/t/serverless-deploy-with-bitbucket-pipelines/20045/1 "2024-03-27T16:40:47Z")

</div>

Hi, Trying to Run Serverless Deploy within a Bitbucket Pipeline but i keep getting `Error:``The security token included in the request is invalid.`

- step:  
name: Assume Role and Deploy to Sandbox  
image: amazon/aws-cli  
oidc: true  
script:  
- export AWS\_REGION=eu-west-1  
- export AWS\_ROLE\_ARN=arn:aws:iam:::role/ssm-bitbucket-automation  
- export AWS\_WEB\_IDENTITY\_TOKEN\_FILE=$(pwd)/web-identity-token  
- echo $BITBUCKET\_STEP\_OIDC\_TOKEN \> $(pwd)/web-identity-token  
- \>-  
CREDS=$(aws sts assume-role-with-web-identity --role-arn arn:aws:iam:::role/ssm-bitbucket-automation --role-session-name ssm-bitbucket-automation --web-identity-token “$BITBUCKET\_STEP\_OIDC\_TOKEN” --duration-seconds 1000 | jq -r ‘.Credentials’)  
- export AWS\_ACCESS\_KEY\_ID=$(echo $CREDS | jq -r ‘.AccessKeyId’)  
- export AWS\_SECRET\_ACCESS\_KEY=$(echo $CREDS | jq -r ‘.SecretAccessKey’)  
- export AWS\_SESSION\_TOKEN=$(echo $CREDS | jq -r ‘.SessionToken’)  
- pipe: atlassian/serverless-deploy:1.5.0  
variables:  
AWS\_ACCESS\_KEY\_ID: $AWS\_ACCESS\_KEY\_ID  
AWS\_SECRET\_ACCESS\_KEY: $AWS\_SECRET\_ACCESS\_KEY  
EXTRA\_ARGS: ‘–stage sandbox --region eu-west-1’
