# Scope undefined in Docker container

**URL:** <https://community.hubspot.com/t/scope-undefined-in-docker-container/68984>\
**Category:** APIs & Integrations\
**Created:** [November 10, 2022, 8:50am UTC](https://community.hubspot.com/t/scope-undefined-in-docker-container/68984 "2022-11-10T08:50:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PJAlberts](https://avatars.discourse-cdn.com/v4/letter/p/eb8c5e/32.png) [@PJAlberts](https://community.hubspot.com/u/PJAlberts)\
**Post date:** [November 10, 2022, 8:50am UTC](https://community.hubspot.com/t/scope-undefined-in-docker-container/68984/1 "2022-11-10T08:50:46Z")

</div>

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”: "---](https://developers.hubspot.com/scopes.%22,%22correlationId%22:%22---) ---==”,“errors”:[{“message”:“One or more of the following scopes are required.”,“context”:{“requiredScopes”:[“contacts”]}}],“links”:{“scopes”:“[https://developers.hubspot.com/scopes"},“category”:"MISSING\_SCOPES](https://developers.hubspot.com/scopes%22%7D,%22category%22:%22MISSING%5C_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

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [November 14, 2022, 9:36pm UTC](https://community.hubspot.com/t/scope-undefined-in-docker-container/68984/2 "2022-11-14T21:36:10Z")

</div>

Hi, @PJAlberts 👋 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

---

<div class="post-metadata">

**Author:** ![PJAlberts](https://avatars.discourse-cdn.com/v4/letter/p/eb8c5e/32.png) [@PJAlberts](https://community.hubspot.com/u/PJAlberts)\
**Post date:** [November 15, 2022, 10:28am UTC](https://community.hubspot.com/t/scope-undefined-in-docker-container/68984/3 "2022-11-15T10:28:59Z")

</div>

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
