Hello, we're seeing regular gateway timeouts when ...
# permit-saas
l
Hello, we're seeing regular gateway timeouts when trying to use the condition sets API, as well as create condition sets via the UI. Our implementation uses condition sets extensively and we can't afford for this endpoint to regularly time out. Is this on your radar to fix? Or can you recommend a work around? Please see the attached for an example of it failing via your UI. This is the body that was sent in the request:
Copy code
{
  "key": "megatest",
  "type": "resourceset",
  "resource_id": "document",
  "name": "megatest",
  "description": "megatest",
  "conditions": {
    "allOf": [
      {
        "allOf": [
          {
            "resource.documentTypeId": {
              "equals": "roflcopter"
            }
          },
          {
            "resource.owner": {
              "equals": "123456"
            }
          }
        ]
      }
    ]
  },
  "parent_id": null
}
a
Hi @Lewis Youl, I'm an AI assistant for Permit.io. I'll analyze available sources and get back to you shortly.
Feel free to tag me with additional questions. I also appreciate feedback, it helps me improve. πŸ‘ button πŸ‘Ž button
o
Hi @Lewis Youl - thanks for reaching out. Few follow up questions? β€’ How often would you say these happen? β€’ Are you operating behind a gateway / VPN / proxy ? β€’ Can you share logs / timestamps of these occurrences ? β€’ Please share your workspace / Project / Env names
l
β€’ They happen at least 50% of the time when trying to create resource sets via the api β€’ No I'm not. β€’ Here are two that just happened:
Copy code
{"level":50,"time":"2025-08-27T12:16:32.146Z","label":"<http://Permit.io|Permit.io>","msg":"Got error status code: 504, err: \"<html>\\r\\n<head><title>504 Gateway Time-out</title></head>\\r\\n<body>\\r\\n<center><h1>504 Gateway Time-out</h1></center>\\r\\n</body>\\r\\n</html>\\r\\n\""}
Failed to create condition set document-08a7b643-272f-460e-89fb-dba8b8848c48-c8217bd9-ed07-4898-b455-f9c9eb615977-resource-set: 3 | import { BASE_PATH } from '../openapi/base';
4 | import { API_ACCESS_LEVELS, ApiContextLevel, ApiKeyLevel, PermitContextError } from './context';
5 | export class PermitApiError extends Error {
6 |     originalError;
7 |     constructor(message, originalError) {
8 |         super(message);
            ^
Error: 
 originalError: AxiosError {
  originalLine: 6,
  originalColumn: 26,
  stack: "Error\n    at settle (/Users/lewisyoul/Repositories/TrustFlight/1-tf/services/user-upstream/node_modules/axios/lib/core/settle.js:19:16)\n    at handleStreamEnd (/Users/lewisyoul/Repositories/TrustFlight/1-tf/services/user-upstream/node_modules/axios/lib/adapters/http.js:599:11)\n    at emit (node:events:84:22)\n    at endReadableNT (internal:streams/readable:862:50)\n    at processTicksAndRejections (native:7:39)\n    at <anonymous> (/Users/lewisyoul/Repositories/TrustFlight/1-tf/services/user-upstream/node_modules/axios/lib/core/Axios.js:45:41)\n    at processTicksAndRejections (native:7:39)",
  message: "Request failed with status code 504",
  name: "AxiosError",
  code: "ERR_BAD_RESPONSE",
  config: [Object ...],
  request: [Object ...],
  response: [Object ...],
  status: 504,
  toJSON: [Function: toJSON],
  isAxiosError: true,
  toString: [Function: toString],
},

      at new PermitApiError (/Users/lewisyoul/Repositories/TrustFlight/1-tf/services/user-upstream/node_modules/permitio/build/module/api/base.mjs:8:9)
      at handleApiError (/Users/lewisyoul/Repositories/TrustFlight/1-tf/services/user-upstream/node_modules/permitio/build/module/api/base.mjs:126:19)
      at <anonymous> (/Users/lewisyoul/Repositories/TrustFlight/1-tf/services/user-upstream/node_modules/permitio/build/module/api/condition-sets.mjs:105:18)

undefined
---
Copy code
{"level":50,"time":"2025-08-27T12:15:40.322Z","label":"<http://Permit.io|Permit.io>","msg":"Got error status code: 504, err: \"<html>\\r\\n<head><title>504 Gateway Time-out</title></head>\\r\\n<body>\\r\\n<center><h1>504 Gateway Time-out</h1></center>\\r\\n</body>\\r\\n</html>\\r\\n\""}
Failed to create condition set document-08a7b643-272f-460e-89fb-dba8b8848c48-c8217bd9-ed07-4898-b455-f9c9eb615977-resource-set: 3 | import { BASE_PATH } from '../openapi/base';
4 | import { API_ACCESS_LEVELS, ApiContextLevel, ApiKeyLevel, PermitContextError } from './context';
5 | export class PermitApiError extends Error {
6 |     originalError;
7 |     constructor(message, originalError) {
8 |         super(message);
            ^
Error: 
 originalError: AxiosError {
  originalLine: 6,
  originalColumn: 26,
  stack: "Error\n    at settle (/Users/lewisyoul/Repositories/TrustFlight/1-tf/services/user-upstream/node_modules/axios/lib/core/settle.js:19:16)\n    at handleStreamEnd (/Users/lewisyoul/Repositories/TrustFlight/1-tf/services/user-upstream/node_modules/axios/lib/adapters/http.js:599:11)\n    at emit (node:events:84:22)\n    at endReadableNT (internal:streams/readable:862:50)\n    at processTicksAndRejections (native:7:39)\n    at <anonymous> (/Users/lewisyoul/Repositories/TrustFlight/1-tf/services/user-upstream/node_modules/axios/lib/core/Axios.js:45:41)\n    at processTicksAndRejections (native:7:39)",
  message: "Request failed with status code 504",
  name: "AxiosError",
  code: "ERR_BAD_RESPONSE",
  config: [Object ...],
  request: [Object ...],
  response: [Object ...],
  status: 504,
  toJSON: [Function: toJSON],
  isAxiosError: true,
  toString: [Function: toString],
},

      at new PermitApiError (/Users/lewisyoul/Repositories/TrustFlight/1-tf/services/user-upstream/node_modules/permitio/build/module/api/base.mjs:8:9)
      at handleApiError (/Users/lewisyoul/Repositories/TrustFlight/1-tf/services/user-upstream/node_modules/permitio/build/module/api/base.mjs:126:19)
      at <anonymous> (/Users/lewisyoul/Repositories/TrustFlight/1-tf/services/user-upstream/node_modules/permitio/build/module/api/condition-sets.mjs:105:18)
There's also the one that I shared the image of that happened via your UI which happened at
Wed, 27 Aug 2025 11:41:43 GMT
.`
workspace = alex-trustflight-sandbox project = sandbox env = lewisdevelopment
o
Thanks, let us review these and circle back to you.
l
For further context, we have also found the check to find out whether a condition set already exists sometimes returns false, even when it does exist, as such we need to rely on the 409 that comes back from the create endpoint.
Thanks
Another instance of this happening, this time on our hosted environment:
Copy code
β”‚ {"level":50,"time":"2025-08-27T14:11:16.279Z","label":"<http://Permit.io|Permit.io>","msg":"Got error status code: 504, err: \"<html>\\r\\n<head><title>504 Gateway Time-out</title></head>\\r\\n<body>\\r\\n<center>< β”‚
β”‚ Failed to remove condition rule for document:read: 3 | import { BASE_PATH } from '../openapi/base';                                                                                                 β”‚
β”‚ 4 | import { API_ACCESS_LEVELS, ApiContextLevel, ApiKeyLevel, PermitContextError } from './context';                                                                                                β”‚
β”‚ 5 | export class PermitApiError extends Error {                                                                                                                                                     β”‚
β”‚ 6 |     originalError;                                                                                                                                                                              β”‚
β”‚ 7 |     constructor(message, originalError) {                                                                                                                                                       β”‚
β”‚ 8 |         super(message);                                                                                                                                                                         β”‚
β”‚             ^                                                                                                                                                                                       β”‚
β”‚ Error:                                                                                                                                                                                              β”‚
β”‚  originalError: AxiosError {                                                                                                                                                                        β”‚
β”‚   originalLine: 6,                                                                                                                                                                                  β”‚
β”‚   originalColumn: 26,                                                                                                                                                                               β”‚
β”‚   stack: "Error\n    at settle (/app/node_modules/axios/lib/core/settle.js:19:16)\n    at handleStreamEnd (/app/node_modules/axios/lib/adapters/http.js:599:11)\n    at emit (node:events:86:22)\n  β”‚
β”‚   message: "Request failed with status code 504",                                                                                                                                                   β”‚
β”‚   name: "AxiosError",                                                                                                                                                                               β”‚
β”‚   code: "ERR_BAD_RESPONSE",                                                                                                                                                                         β”‚
β”‚   config: [Object ...],                                                                                                                                                                             β”‚
β”‚   request: [Object ...],                                                                                                                                                                            β”‚
β”‚   response: [Object ...],                                                                                                                                                                           β”‚
β”‚   status: 504,                                                                                                                                                                                      β”‚
β”‚   toJSON: [Function: toJSON],                                                                                                                                                                       β”‚
β”‚   isAxiosError: true,                                                                                                                                                                               β”‚
β”‚   toString: [Function: toString],                                                                                                                                                                   β”‚
β”‚ },                                                                                                                                                                                                  β”‚
β”‚                                                                                                                                                                                                     β”‚
β”‚       at new PermitApiError (/app/node_modules/permitio/build/module/api/base.mjs:8:9)                                                                                                              β”‚
β”‚       at handleApiError (/app/node_modules/permitio/build/module/api/base.mjs:126:19)                                                                                                               β”‚
β”‚       at <anonymous> (/app/node_modules/permitio/build/module/api/condition-set-rules.mjs:81:18)                                                                                                    β”‚
β”‚                                                                                                                                                                                                    
β”‚ undefined
workspace = alex-trustflight-sandbox project = default env = dev
o
@Omer Zuarets is on the case
πŸ‘ 1
l
This was for trying to use
this.permit.api.conditionSetRules.delete
. So it's a different endpoint but related to condition sets again.
We're also seeing your UI time out when trying to remove condition set rules. A colleague (Yilmaz)is recording a video at the moment.
y
This is also happening in UI
o
Thank you, hopefully this information would help us to pinpoint the underlying issue quickly
l
Thank you for the quick response. It would be great if this could be resolved as it is hamstringing us rather at the moment.
o
I’m confident it would be resolved (my intuition is this is some underlying DB issue), but I’ll let Omer do his work/magic πŸ˜‰
🀞 1
a
Hey @Lewis Youl, I went through this with @Omer Zuarets, and we found the issue. It’s being reviewed and tested now, and we’re hoping it’ll be in production by tomorrow or early next week. Really appreciate all the details you sharedβ€”they were super helpful! :)
πŸ™Œ 1
l
That's great news, thank you for the update and for looking into it!
Will you let us know when it is live?
(Or is there some other way we can find out?)
a
We will let you know when it's in production, And you can use the
/permit-ticket-status
with the ticket PER-12695 to track the status also πŸ™πŸΌ
πŸ‘ 1
l
Is there an an update on when this will be live? The ticket status doesn't seem to have moved in a couple of days and as such our implementation cannot function.
o
Likely early next week. It's in the acceptance (testing and review) phase, we take testing with extra care here.
l
OK thanks. To help with your testing, the endpoint that is consistently failing (504) is the one to remove a condition set rule. In our system specifically, it is failing when the resource set is for the
document
resource. We are able to remove condition set rules for other resources such as
document_type
. The one to create resource sets fails intermittently for the same reason.
o
Hey @Lewis Youl The endpoints you attached until now were the create endpoint if I understood correctly which is what we fixed aim to release on Sunday. To make sure we look at the right one regarding the delete, are you talking on a delete conditionset or delete set rules ?
l
Deleting a condition set rule.
I'll get you some examples.
o
Thanks, we’ll aim to release this also on Sunday
l
Copy code
DELETE /v2/facts/9aa8bcdc454049cd8c1459f6d1215b4f/890e358221b34dee9ac6fb6103b762f8/set_rules - 504 Gateway Timeout

body:

{ 
  "user_set": "c91cddb1-e571-46e5-821d-056b6e0100f4-user-set",  
  "resource_set": "document-50c415ef-5713-431a-96ac-2a1c7ce128d7-c8217bd9-ed07-4898-b455-f9c9eb615977-resource-set",
  "permission":"document:update"
}

workspace: alex-trustflight-sandbox
project: sandbox
env: lewisdevelopment
I've attached an image for an identical request for
document_type
that is made just before the one for
document
. The
document_type
one always succeeds so I can see it in the api logs. The one for
document
always fails and I can't see it in the logs. This happens in different environments too, not just my one. > The endpoints you attached until now were the create endpoint I did mention this endpoint earlier in the thread too https://permit-io.slack.com/archives/C02RTML2WNN/p1756304306634849?thread_ts=1756295397.608009&cid=C02RTML2WNN
a
Hey @Lewis Youl, The fixes for creating and updating condition sets are now live in production. The fix for deleting condition set rules is in progress and should be deployed in the next few days. Thanks again for flagging this β€” we’ll update you once it’s live!
l
OK thanks for the update. We really need these resolved as it essentially renders permit unusable right now for us. Users can't toggle their permissions.
o
We let you know as soon as it’s fixed, the delete is the only one left, right ?
l
As well as this one I'm also talking with you on https://permit-io.slack.com/archives/C02RTML2WNN/p1756487273851679.
o
β€’ Delete set_rules β€’ PATCH resource instance Anything else ? We’ll also try to go over other APIs around that to see if we see any other performance lacks there but we’ll prioritize fixing and deploying those two before others
l
Yes those two. We're manually testing our integration heavily at the moment so I will flag anything else we spot as soon as I can.
What is your confidence level in having the "Delete set_rules" issue resolved in the next couple of days?
a
Hey @Lewis Youl , it’s now on reviewing and testing. I believe tomorrow it’s gonna be live in production
l
Excellent, thank you for the prompt response.
Is this live?
a
It will happen in the coming hours, I’ll keep you updated.
l
Thank you
o
Hey @Lewis Youl the fix for those two APIs is now being deployed to production. You should be able to experience them shortly
y
@Omer Zuarets I tested them this morning and they work as expected. thanks.
πŸ’œ 2
l
Indeed, thank you!
πŸ’œ 1