Migration error: Cannot activate repos (bitbucket cloud)

I’m migrating from 0.8 to 1.2 for fixing issue with bitbucket v2 API.
During migration process I had to deactivate all repos due to it failed on update-repos command (credentials error).
Now drone server 1.2 is working but when I try to activate a repo it fails and gives again a credential error:

There was a problem enabling your repository.
Your credentials lack one or more required privilege scopes…


  • my user is administrator of the repository and application drone have grant access in my account
  • there isn’t reverse proxy server
  • custom port 8050 for drone server

Here is my compose file:

    image: drone/drone:1.2
      - 8050:80
      - /var/lib/drone:/var/lib/drone/
    restart: always
      - DRONE_TLS_AUTOCERT=false
      - DRONE_REPOSITORY_FILTER=datalife_sco
      - DRONE_LOGS_DEBUG=true

and the debug log:

{"level":"debug","msg":"events: stream opened","request-id":"1NVetfxebuRfZcB7WbgzRDDG8YT","time":"2019-07-03T16:21:47Z","user.login":"sergyo"}
{"level":"debug","msg":"api: read access granted","name":"trytond-account_asset_percentage","namespace":"datalife_sco","request-id":"1NVetsB3G8TBbIvWd6rypoSFIYQ","time":"2019-07-03T16:21:48Z","user.login":"sergyo","visibility":"public"}
{"admin":true,"level":"debug","msg":"api: access granted","name":"trytond-account_asset_percentage","namespace":"datalife_sco","read":true,"request-id":"1NVetsB3G8TBbIvWd6rypoSFIYQ","time":"2019-07-03T16:21:48Z","user.login":"sergyo","visibility":"public","write":true}
{"error":"Your credentials lack one or more required privilege scopes.","level":"debug","msg":"api: cannot create or update hook","name":"trytond-account_asset_percentage","namespace":"datalife_sco","request-id":"1NVetsB3G8TBbIvWd6rypoSFIYQ","time":"2019-07-03T16:21:48Z","user.login":"sergyo"}

Any idea?

This error comes from bitbucket. There are only 2 root causes that I am aware of for this error. Either you lack admin access to the repository (you have indicated this is not the case) or the oauth2 application was not created with the correct scopes.

There error message seems to indicate this is an issue with scope, so I recommend double-checking your configuration and if you continue to experience issues you might want to check with bitbucket support.

Your credentials lack one or more required privilege scopes

Thanks! you point me out to the real issue.
I missed to add permissions to Pull request as described on official documentation.

Now I can activate repositories!

I decided to execute the migration process again to solve update-repos issue. All the process finish correctly, but when a start drone server the activity feed of all repositories are empty; no build history are present. Repository secrets are empty as well.
Am I missing anything?

I miss to define DRONE_DATABASE_DATASOURCE environment variable so container was connecting to a fresh database.
Sorry for the inconvenience …