Marius Baci
12/10/2025, 1:07 PMAsk Inkeep
12/10/2025, 1:07 PMAsk Inkeep
12/10/2025, 1:08 PM<http://api.permit.io|api.permit.io>. In containerized environments (especially ECS) , DNS configuration can sometimes cause failures. (1)
• *Network/firewall rules* – Ensure your ECS task has outbound HTTPS access (port 443) to <http://api.permit.io|api.permit.io>.
• *Invalid or expired API key* – Double-check your PDP_API_KEY environment variable is correctly set. (2)
*For ECS deployments, verify your task definition includes:*
• Container port 7000 open (required for SDK connections)
• The PDP_API_KEY environment variable set correctly
• Image URI: permitio/pdp-v2:latest (or your specific version like 0.9.2)
*
To help our engineers investigate further, please provide:
1. Which *Workspace / Project / Environment* you're using
2. What *calls* you're performing (SDK code or CURL)
3. The *PDP version* you're running (you mentioned 0.9.2)
4. The *relevant logs* from your PDP (please paste them here)Ask Inkeep
12/10/2025, 1:08 PMMarius Baci
12/10/2025, 1:08 PMWARNING | Opa connection error: ClientConnectorError(ConnectionKey(host='localhost', port=8181, is_ssl=False, ssl=True, proxy=None, proxy_auth=None, proxy_headers_hash=None), ConnectionRefusedError(111, "Connect call failed ('127.0.0.1', 8181)"))
[34mopal_client.data.updater [0m|[31m[1mERROR | Failed to save data update to policy-store: RetryError[<Future at 0xffff949e5c00 state=finished raised ClientConnectorError>]
[1mTraceback (most recent call last):[0m
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1248, in _wrap_create_connection
sock = await aiohappyeyeballs.start_connection(
File "/usr/local/lib/python3.10/site-packages/aiohappyeyeballs/impl.py", line 122, in start_connection
raise first_exception
File "/usr/local/lib/python3.10/site-packages/aiohappyeyeballs/impl.py", line 73, in start_connection
sock = await _connect_sock(
File "/usr/local/lib/python3.10/site-packages/aiohappyeyeballs/impl.py", line 208, in _connect_sock
await loop.sock_connect(sock, address)
File "uvloop/loop.pyx", line 2633, in sock_connect
await fut
File "uvloop/loop.pyx", line 1108, in uvloop.loop.Loop._sock_connect_cb
raise OSError(err, 'Connect call failed %s' % (address,))
[31m[1mConnectionRefusedError[0m:[1m [Errno 111] Connect call failed ('127.0.0.1', 8181)[0m
[1mThe above exception was the direct cause of the following exception:[0m
[33m[1mTraceback (most recent call last):[0m
File "/usr/local/lib/python3.10/site-packages/tenacity/asyncio/__init__.py", line 114, in __call__
result = await fn(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/opal_client/policy_store/opa_client.py", line 766, in set_policy_data
async with session.put(
File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 1482, in __aenter__
self._resp: _RetType = await self._coro
File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 770, in _request
resp = await handler(req)
File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 725, in _connect_and_send_request
conn = await self._connector.connect(
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 622, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1189, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1561, in _create_direct_connection
raise last_exc
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1530, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1271, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
[31m[1maiohttp.client_exceptions.ClientConnectorError[0m:[1m Cannot connect to host localhost:8181 ssl:default [Connect call failed ('127.0.0.1', 8181)][0m
[1mThe above exception was the direct cause of the following exception:[0m
[33m[1mTraceback (most recent call last):[0m
File "/usr/local/lib/python3.10/site-packages/opal_client/data/updater.py", line 547, in _fetch_and_save_data
await self._store_fetched_data(entry, result, store_transaction)
File "/usr/local/lib/python3.10/site-packages/opal_client/data/updater.py", line 645, in _store_fetched_data
await self._set_policy_data(
File "/usr/local/lib/python3.10/site-packages/opal_client/data/updater.py", line 706, in _set_policy_data
await tx.set_policy_data(data, path=path)
File "/usr/local/lib/python3.10/site-packages/tenacity/asyncio/__init__.py", line 189, in async_wrapped
return await copy(fn, *args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/tenacity/asyncio/__init__.py", line 111, in __call__
do = await self.iter(retry_state=retry_state)
File "/usr/local/lib/python3.10/site-packages/tenacity/asyncio/__init__.py", line 153, in iter
result = await action(retry_state)
File "/usr/local/lib/python3.10/site-packages/tenacity/_utils.py", line 99, in inner
return call(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/tenacity/__init__.py", line 419, in exc_check
raise retry_exc from fut.exception()
[31m[1mtenacity.RetryError[0m:[1m RetryError[<Future at 0xffff949e5c00 state=finished raised ClientConnectorError>][0m
[32m2025-12-10T12:43:32.205560+0000[0m | [34mopal_client...base_policy_store_client [0m|[31m[1mERROR | OPA transaction failed, transaction id=c2792dc539474d51860e8d76b6dc3d67, actions=['set_policy_data'], error=Failed to save data to policy store: RetryError[<Future at 0xffff949e5c00 state=finished raised ClientConnectorError>][0mMarius Baci
12/10/2025, 1:10 PMAlon Boshi
12/10/2025, 1:33 PMAsk Inkeep
12/10/2025, 1:33 PMAsk Inkeep
12/10/2025, 1:33 PMlocalhost:8181 — this is an internal connection issue within the PDP container where the inline OPA engine becomes unreachable after running for some time.
*What's happening:*
The PDP runs OPA inline (inside the same container) , and the OPAL client needs to push policy/data updates to OPA at localhost:8181. Your logs show ConnectionRefusedError [Errno 111] which means OPA stopped responding or crashed. (1)
*Possible causes for intermittent failures:*
1. *OPA process crashing* – The inline OPA binary may be terminating unexpectedly due to memory pressure or other resource constraints in your ECS task.
2. *Resource limits* – If your ECS task has tight memory/CPU limits, OPA might get OOM-killed after running for a while.
3. *Architecture mismatch* – If you're running on ARM64 (Graviton) , there's a known issue with the OPA binary in certain PDP versions. (2)
*Troubleshooting steps:*
1. *Check ECS task resource allocation* – Ensure sufficient memory (recommend at least 512MB-1GB for the PDP container) .
2. *Enable more verbose logging* to see if OPA is crashing:
OPAL_INLINE_OPA_LOG_FORMAT=http
OPAL_LOG_LEVEL=DEBUG
(3) , (4)
3. *Check if you're on ARM64* – If using Graviton instances, try pinning to an AMD64 image or check if a newer PDP version fixes the ARM64 OPA binary issue. (2)
4. *Monitor container health* – Look at ECS CloudWatch metrics for memory spikes or container restarts.
*
To help our engineers investigate further, please provide:
1. Which *Workspace / Project / Environment* you're using
2. What *calls* you're performing (SDK code or CURL)
3. Confirm the *PDP version* (0.9.2) and *ECS instance architecture* (x86 or ARM64/Graviton)
4. Any additional logs showing what happens before the OPA connection errors startAsk Inkeep
12/10/2025, 1:33 PMAsk Inkeep
12/10/2025, 1:36 PMMarius Baci
12/15/2025, 4:13 PMpermitio/pdp-v2:0.9.9 as this version seemed to have a fix for that (https://github.com/permitio/PDP/commit/b42fae2cf18a13ae1263b22daba703082967ce9c from https://github.com/permitio/PDP/compare/0.9.8...0.9.9). but unfortunately the issue still appears.Marius Baci
12/15/2025, 4:15 PMMarius Baci
12/15/2025, 4:16 PMMarius Baci
12/15/2025, 4:16 PMOr Weis
12/15/2025, 4:52 PMOr Weis
12/15/2025, 4:53 PMEli Moshkovich
12/15/2025, 5:49 PMEli Moshkovich
12/15/2025, 6:02 PMCannot connect to host localhost:8181
ConnectionRefusedError ('127.0.0.1', 8181)
This means that, at that point in time, the OPA engine was not listening on port 8181 - for example, due to a restart or crash.
Can you confirm whether the ECS tasks are still running when this happens, and whether you see any restarts or unhealthy events around that time?Marius Baci
12/19/2025, 9:20 AMMarius Baci
12/19/2025, 11:21 AMOr Weis
12/19/2025, 11:24 AMEli Moshkovich
12/19/2025, 3:32 PM<http://746127402929.dkr.ecr.eu-west-1.amazonaws.com/platform-test-brickguard-pdp-repository:platform-test-brickguard-pdp-0.9.9|746127402929.dkr.ecr.eu-west-1.amazonaws.com/platform-test-brickguard-pdp-repository:platform-test-brickguard-pdp-0.9.9>
Just to clarify - we can only provide support for the official PDP images.
Could you please try running the latest official version instead?
permitio/pdp-v2:latest
This will help us confirm whether the issue is coming from the custom build.
One more thing I noticed:
In your task definition the container CPU reservation is set to 0, which can sometimes lead to CPU starvation on ECS Fargate. That can cause OPA to become temporarily unresponsive.
Let us know once you’ve tested with the official image, and we can continue from there.Marius Baci
12/19/2025, 3:40 PMMarius Baci
12/19/2025, 3:41 PM- name: Pull, tag, and push Docker BrickGuard-PDP image
env:
ECR_REPOSITORY_URL: ${{ steps.get-ecr-url.outputs.ecr-url }}
WORKSPACE: ${{ inputs.workspace }}
SOURCE_IMAGE: permitio/pdp-v2:0.9.9
run: |
set -eo pipefail
VERSION=$(echo $SOURCE_IMAGE | cut -d':' -f2)
IMAGE_TAG=${WORKSPACE}-${{ vars.ACCOUNT }}-brickguard-pdp-${VERSION}
ECR_IMAGE=${ECR_REPOSITORY_URL}:${IMAGE_TAG}
ECR_REPO_NAME=$(echo $ECR_REPOSITORY_URL | cut -d'/' -f2)
IMAGE_EXISTS=$(aws ecr describe-images \
--repository-name $ECR_REPO_NAME \
--image-ids imageTag=${IMAGE_TAG}\
--region ${{ vars.AWS_REGION }} \
--query 'imageDetails' --output text 2>/dev/null || true)
if [[ -n "$IMAGE_EXISTS" ]]; then
echo "Image: $ECR_IMAGE already exists. Skipping push."
else
echo "Pulling image: $SOURCE_IMAGE"
docker pull --platform linux/arm64 $SOURCE_IMAGE
echo "Tagging image: $SOURCE_IMAGE as $ECR_IMAGE"
docker tag $SOURCE_IMAGE $ECR_IMAGE
echo "Pushing image: $ECR_IMAGE to ECR"
docker push $ECR_IMAGE
fiMarius Baci
12/19/2025, 3:48 PMEli Moshkovich
12/19/2025, 3:51 PMcontainerDefinitions section.
In your current task definition you have:
"containerDefinitions": [
{
"cpu": 0,
...
}
]
When cpu: 0, the container has no reserved CPU allocation, which can cause resource starvation under load. This could explain why OPA becomes unresponsive intermittently.
Try updating the container definition to explicitly reserve resources:
"containerDefinitions": [
{
"cpu": 512,
"memory": 1024,
...
}
]
Let us know once you try this, and we’ll continue from there.Marius Baci
12/19/2025, 3:51 PMMarius Baci
12/19/2025, 3:52 PMMarius Baci
12/19/2025, 3:52 PMMarius Baci
12/19/2025, 3:53 PMEli Moshkovich
12/19/2025, 3:56 PMPDP_DEBUG=True to the environment variables for more detailed logs
2. Check CloudWatch metrics for Memory Utilization on this task - if OPA is crashing due to OOM, you'd see memory spike to ~100% right before the errors
Let us know how it goes.Marius Baci
12/19/2025, 4:02 PM