Hi, everyone. We are currently encountering this e...
# permit-saas
j
Hi, everyone. We are currently encountering this error across all environments of our Permit setup. We are using the Cloud PDP. Appreciate any inshgt on this error. Thank you!
Copy code
Permit.getUserPermissions() got an unexpected status code: 502, please check your SDK init and make sure the PDP sidecar is configured correctly.\nRead more about setting up the PDP at <https://docs.permit.io/sdk/python/quickstart-python/#2-setup-your-pdp-policy-decision-point-container>
a
Hi @Jazmine Reyes, I'm an AI assistant for Permit.io. I'll analyze available sources and get back to you shortly.
p
Hey, thanks for reaching out ! It seems our team is a little busy right now, a human will be with you within the next hour or so. In the meantime, can I help you ?
a
A 502 error from the Cloud PDP typically indicates a gateway or connectivity issue with the managed service at
<https://cloudpdp.api.permit.io>
(1) (2) . Here are some troubleshooting steps: ​*1. Verify your SDK initialization*​ Ensure you're pointing to the Cloud PDP correctly:
Copy code
from permit import Permit

permit = Permit(
    token="[your-api-key]",
    pdp="<https://cloudpdp.api.permit.io>",
)
(3) ​*2. Check for known issues*​ There's a known issue where the Python SDK uses lowercase
bearer
in the Authorization header, but Cloud PDP requires uppercase
Bearer
per RFC 6750 (4) . This can cause 401 errors, though you're seeing 502. ​*3. Verify API key validity*​ Ensure your API key is correct and hasn't been rotated or revoked (3) . ​*4. Check Cloud PDP status*​ Since this is affecting all your environments, there may be a temporary service issue with the managed Cloud PDP. To help our engineers investigate further, please provide: 1. Which Workspace / Project / Env you are using 2. What calls you are performing (as SDK code or CURL) 3. Which PDP version you are running (in your case, Cloud PDP) 4. Any relevant logs from your application when the error occurs If the issue persists, you might consider deploying an Edge PDP (self-hosted) as an alternative, which runs in your own infrastructure and can provide better
To learn more, see the sources I considered: [[1] Permit's PDP (Policy Decision Point)](https://docs.permit.io/concepts/pdp/overview) [[2] Run your First Policy Check (Managed Cloud PDP)](https://docs.permit.io/overview/perform-policy-check-with-cloud-pdp) [[3] Python Quickstart Async](https://docs.permit.io/sdk/python/quickstart-python) [[4] Cloud PDP returns 401 due to lowercase "bearer" in Authorization header](https://github.com/permitio/permit-python/issues/122)
j
1. We are using one of the projects under the workspace
<http://consoleconnect.com|consoleconnect.com>
. This project currently has 3 environments (Development, Uat, Production). Currently these environments are having this issue when connecting to the Cloud PDP. 2. We are calling the get_user_permissions and the check endpoints using the python sdk. Actually anything we try to call is returning the 50 error 3. Cloud PDP 4. Logs received: Permit.getUserPermissions() got an unexpected status code: 502, please check your SDK init and make sure the PDP sidecar is configured correctly.\nRead more about setting up the PDP at https://docs.permit.io/sdk/python/quickstart-python/#2-setup-your-pdp-policy-decision-point-container
o
Hi Jazmine is the issue persisting, do you get a similar result with a local PDP
j
Hi @Or Weis. I was initially getting the same result with a local PDP. But it is working now. Thank you!
💜 1
p
Hey, thanks for reaching out ! It seems our team is a little busy right now, a human will be with you within the next hour or so. In the meantime, can I help you ?