Scope undefined in Docker container

Hi all,

I’m rather stuck with my integration which uses the **Contacts Search

API (**

/crm/v3/objects/contacts/search).

The error message (correlationId removed):

{“status”:“error”,“message”:“This app hasn’t been granted all required scopes to make this call. Read more about required scopes here: https://developers.hubspot.com/scopes.",“correlationId”: "--- ---==”,“errors”:[{“message”:“One or more of the following scopes are required.”,“context”:{“requiredScopes”:[“contacts”]}}],“links”:{“scopes”:“https://developers.hubspot.com/scopes"},“category”:"MISSING\_SCOPES”}

Scopes given to private app as per documentation:

  • crm.objects.contacts.read (required as per documentation)
  • crm.objects.contacts.write
  • crm.schemas.contacts.read
  • crm.schemas.contacts.write

Behaviour:

  • When instantiating the Python Integration class from the Python shell (not in a Docker container), the requests to the Contacts search endpoint works flawlessly and data is retrieved.
  • When running the same integration from within a Docker containe as a worker, the scoping error provided is displayed.

Debugging performed:

  • Added a breakpoint using ipdb where the environment variable for the Private App key is imported from the environment
    • Result: Private App key successfully imported
  • Added a breakpoint where my HubSpot_Client class is instantiated with the Private App key as a parameter
    • Result: HubSpot_Client class instantiated with the correct HubSpot API Private App key
  • Added a breakpoint in the function where the Private App key is added to the request header
    • Result: Private App key successfully added to the request header

Questions:

  1. Are any further permissions required to make requests from a certain environment, like a Docker container?
  2. Could using the same key for testing in the Python shell and in a Docker container be causing the request to be rejected for some reason?

Thank you for your time!

Johann

Hi, @PJAlberts :waving_hand: Thank you for including all those details.

I am going to tag a few community members to see if anyone has an insight or tip for us. Or is you’ve managed to get moving forward, any details you can share is greatly appreciated.

Hey, @nikodev @Teun @JBeatty @taran42, any experience using Docker containers + Python in the manner @PJAlberts is describing?

Best,

Jaycee

Hi all. This matter has been resolved now. It had nothing to do with the scopes but more to do with my sausage fingers. I managed to add an additional character to my API key when copy-pasting it, so the key was invalid. Thank you very much for looking into it!

Johann