1

I am trying build bitbucket pipelines with SFDX and got stuck in the first stage.

I have followed this blog and created serverykey and certificate files.

http://www.wadewegner.com/2018/01/jwt-oauth-with-scratch-orgs/

And created Connected App and added certificate:

enter image description here

Added permissions to the connected app: enter image description here

enter image description here

And also configured the Environment variables in Bitbucket: enter image description here

Added serverkey to bitbycket: enter image description here

And here is my yml script:

# CI process for SFDX
image: illbilly/sfdx #image with sfdx installed
pipelines:
  default: #this will run for all branches unless specificed otherwise
    - step:
        name: Auth. with DevHub
        script:
                - sfdx force:auth:jwt:grant -i $CLIENT_ID -f jwt/server.key -u $DEVHUB_USERNAME --setdefaultdevhubusername --setalias DevHub
                - sfdx force:org:list
    - step:
        name: Create Scratch Org.
        script:
                - sfdx force:org:list
                - sfdx force:org:create -f environments/scratchorg1-scratch-def.json -v DevHub -a bitbucket_build_$BITBUCKET_BUILD_NUMBER

When I run the build: I am getting this below error, inspite of having the profile access to the connected app. what am I missing:

enter image description here

ERROR:

An error occurred authorizing this org. name: invalid_grant message: user hasn't approved this consumer

  • Just to be sure, did you add the permission set to the user making the deployment ? – Fabien Taillon Jun 18 '18 at 8:32
  • Yes. I did. Added profile and permset both. – Ajay Jun 18 '18 at 9:13
  • If you go to login history for this user, do you see the same error message ? – Fabien Taillon Jun 18 '18 at 9:18
0

My bad. It was too silly mistake what I have done. The username of the org is wrong in environment variables in bitbucket.

I got another issue, let me see how can fix it.l

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.