HTTP Error 500 When Creating TCP Resource via Integration API #441

Closed
opened 2025-11-13 12:00:41 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @AndrewPaglusch on GitHub (Jun 16, 2025).

Originally assigned to: @miloschwartz on GitHub.

I am on Pangolin v1.5.1 Community Edition.

When attempting to create a raw TCP resource via the integration API, I receive back a generic HTTP 500 error:

$ curl -X PUT 'https://dmz-api.REDACTED.com/v1/org/REDACTED/site/2/resource' -H 'Authorization: Bearer REDACTED' -H 'Content-Type: application/json' -d '{"name": "TCP Port 2345", "siteId": 2, "http": false, "protocol": "tcp", "proxyPort": 2345}'

{"data":null,"success":false,"error":true,"message":"An error occurred","status":500,"stack":null}

I compared the API call made by my browser when creating an identical TCP resource in the Pangolin UI, and despite the URL being different, the request appeared to be identical in almost every way, sans some extra headers my browser added in.

I see nothing in the container logs when making this API call.

Despite getting the error, the resource is created correctly.

Originally created by @AndrewPaglusch on GitHub (Jun 16, 2025). Originally assigned to: @miloschwartz on GitHub. I am on Pangolin v1.5.1 Community Edition. When attempting to create a raw TCP resource via the integration API, I receive back a generic HTTP 500 error: ``` $ curl -X PUT 'https://dmz-api.REDACTED.com/v1/org/REDACTED/site/2/resource' -H 'Authorization: Bearer REDACTED' -H 'Content-Type: application/json' -d '{"name": "TCP Port 2345", "siteId": 2, "http": false, "protocol": "tcp", "proxyPort": 2345}' {"data":null,"success":false,"error":true,"message":"An error occurred","status":500,"stack":null} ``` I compared the API call made by my browser when creating an identical TCP resource in the Pangolin UI, and despite the URL being different, the request appeared to be identical in almost every way, sans some extra headers my browser added in. I see nothing in the container logs when making this API call. Despite getting the error, the resource is created correctly.
GiteaMirror added the bugapi labels 2025-11-13 12:00:41 -06:00
Author
Owner

@AndrewPaglusch commented on GitHub (Jun 16, 2025):

I've just given full permissions to the API key I'm using, so I can rule out any type of permission issue as the cause

@AndrewPaglusch commented on GitHub (Jun 16, 2025): I've just given full permissions to the API key I'm using, so I can rule out any type of permission issue as the cause
Author
Owner

@oschwartz10612 commented on GitHub (Jun 16, 2025):

Hum definitely sounds like a bug. Are you sure there is nothing in the logs when you do this? An error should be thrown at the same time.

@oschwartz10612 commented on GitHub (Jun 16, 2025): Hum definitely sounds like a bug. Are you sure there is nothing in the logs when you do this? An error should be thrown at the same time.
Author
Owner

@AndrewPaglusch commented on GitHub (Jun 16, 2025):

I believe I had my logging misconfigured. After fixing it, the following was logged when making the API call:

pangolin  | 2025-06-16T18:33:56.589Z [error]: NOT NULL constraint failed: userResources.userId
pangolin  | Stack: SqliteError: NOT NULL constraint failed: userResources.userId
pangolin  |     at PreparedQuery.run (file:///app/node_modules/drizzle-orm/better-sqlite3/session.js:66:22)
pangolin  |     at QueryPromise.run (file:///app/node_modules/drizzle-orm/sqlite-core/query-builders/insert.js:152:28)
pangolin  |     at QueryPromise.execute (file:///app/node_modules/drizzle-orm/sqlite-core/query-builders/insert.js:164:54)
pangolin  |     at QueryPromise.then (file:///app/node_modules/drizzle-orm/query-promise.js:21:17) {"code":"SQLITE_CONSTRAINT_NOTNULL"}
@AndrewPaglusch commented on GitHub (Jun 16, 2025): I believe I had my logging misconfigured. After fixing it, the following was logged when making the API call: ``` pangolin | 2025-06-16T18:33:56.589Z [error]: NOT NULL constraint failed: userResources.userId pangolin | Stack: SqliteError: NOT NULL constraint failed: userResources.userId pangolin | at PreparedQuery.run (file:///app/node_modules/drizzle-orm/better-sqlite3/session.js:66:22) pangolin | at QueryPromise.run (file:///app/node_modules/drizzle-orm/sqlite-core/query-builders/insert.js:152:28) pangolin | at QueryPromise.execute (file:///app/node_modules/drizzle-orm/sqlite-core/query-builders/insert.js:164:54) pangolin | at QueryPromise.then (file:///app/node_modules/drizzle-orm/query-promise.js:21:17) {"code":"SQLITE_CONSTRAINT_NOTNULL"} ```
Author
Owner

@miloschwartz commented on GitHub (Jun 17, 2025):

Ah I think I know what's causing this. Will try to have a fix in the next release.

@miloschwartz commented on GitHub (Jun 17, 2025): Ah I think I know what's causing this. Will try to have a fix in the next release.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/pangolin#441