Article - CS339610

ThingWorx Flow login page fails to load with "502 Bad Gateway" or "504 Gateway Timeout" error after installation

Modified: 09-Feb-2026   


Applies To

  • ThingWorx Platform 9.1 to 9.5
  • Nginx

Description

  • Failed to access ThingWorx Flow home page
  • ThingWorx Flow modules are online but login attempts return 502 Bad Gateway nginx
  • Using F12/Developer Tools in the Web Browser shows that the currentUser API call returns below error:
Failed to load resource: the server responded with a status of 504 (Gateway Timeout) - HTTP 504 Gateway Timeout
  • Login window does not pop up
  • ThingWorx Flow is not accessible when using self-signed certificate
  • Using F12/Developer Tools in the Web Browser shows fetchconfig returns status 502
  • 504 Gateway timeout appears when trying to access the login page
  • trigger_error-xxxx.log contains below errors:  
    {"module":"flow-trigger","timestamp":"YYYY-MM-DDThh:mm:ss.965Z","level":"error","message":"Error deleting from message table"}
    {"module":"flow-trigger","timestamp":"YYYY-MM-DDThh:mm:ss.965Z","level":"error","message":"Login failed for user &#39;<user_name>&#39;."}
    {"module":"flow-trigger","timestamp":"YYYY-MM-DDThh:mm:ss.965Z","level":"error","message":"Error: Login failed for user &#39;<user_name>&#39;.    at Login7TokenHandler.onErrorMessage (D:\\ThingWorxFlow\\modules\\trigger\\node_modules\\tedious\\lib\\token\\handler.js:239:19)    at Readable.&lt;anonymous&gt; (D:\\ThingWorxFlow\\modules\\trigger\\node_modules\\tedious\\lib\\token\\token-stream-parser.js:26:33)    at Readable.emit (events.js:315:20)    at addChunk (internal/streams/readable.js:309:12)    at readableAddChunk (internal/streams/readable.js:284:9)    at Readable.push (internal/streams/readable.js:223:10)    at next (internal/streams/from.js:88:29)    at runMicrotasks (&lt;anonymous&gt;)    at processTicksAndRejections (internal/process/task_queues.js:93:5)"}
    {"module":"flow-trigger","timestamp":"YYYY-MM-DDThh:mm:ss.966Z","level":"error","message":"Error updating subscriptions"}
    {"module":"flow-trigger","timestamp":"YYYY-MM-DDThh:mm:ss.966Z","level":"error","message":"Login failed for user &#39;<user_name>&#39;."}
    {"module":"flow-trigger","timestamp":"YYYY-MM-DDThh:mm:ss.966Z","level":"error","message":"Error: Login failed for user &#39;<user_name>&#39;.    at Login7TokenHandler.onErrorMessage (D:\\ThingWorxFlow\\modules\\trigger\\node_modules\\tedious\\lib\\token\\handler.js:239:19)    at Readable.&lt;anonymous&gt; (D:\\ThingWorxFlow\\modules\\trigger\\node_modules\\tedious\\lib\\token\\token-stream-parser.js:26:33)    at Readable.emit (events.js:315:20)    at addChunk (internal/streams/readable.js:309:12)    at readableAddChunk (internal/streams/readable.js:284:9)    at Readable.push (internal/streams/readable.js:223:10)    at next (internal/streams/from.js:88:29)    at runMicrotasks (&lt;anonymous&gt;)    at processTicksAndRejections (internal/process/task_queues.js:93:5)"}
  • Can access ThingWorx Flow via Flow's hostname and URL, but fail to access it from ThingWorx Composer URL at ThingWorx Composer > Flow > Connector with below error: 
404 page not found error
  • Error when executing ValidateFlowSetup from  System > Subsystems > WorkflowSubsystem
[FLOW-API-02] - Failed to connect to Flow. Ensure that you are accessing ThingWorx via Nginx URL. Ensure that all Flow services are running and are healthy. In case of self-signed certificate, make sure that correct CN is provided. [FLOW-OAUTH-02] - Failed to connect to Flow OAuth service. Check whether Flow keys are imported in ThingWorx KeyStore. For more information, refer to the 'Troubleshooting Your Installation' topic in the Help Center
  • Error message appears in ThingWorx Flow log file ,,,\ThingWorxFlow\.pm2\logs\flow-api-error-0.log:
TypeError: Cannot read property 'statusCode' of undefined
    at /opt/ThingWorxFlow/modules/ux/dist/helpers/twxUserHelper.js:25:285
    at Request._callback (/opt/ThingWorxFlow/modules/ux/dist/helpers/twxUserHelper.js:8:977)
    at self.callback (/opt/ThingWorxFlow/modules/ux/node_modules/request/request.js:185:22)
    at Request.emit (events.js:314:20)
    at Request.onRequestError (/opt/ThingWorxFlow/modules/ux/node_modules/request/request.js:881:8)
    at ClientRequest.emit (events.js:314:20)
    at ClientRequest.onConnect (/opt/ThingWorxFlow/modules/ux/node_modules/tunnel-agent/index.js:168:23)
    at Object.onceWrapper (events.js:421:26)
    at ClientRequest.emit (events.js:314:20)
    at Socket.socketOnData (_http_client.js:508:11)
    at Socket.emit (events.js:314:20)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:272:9)
    at Socket.Readable.push (_stream_readable.js:213:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
Uncaught exception: TypeError: Cannot read property 'statusCode' of undefined
 
This is a printer-friendly version of Article 339610 and may be out of date. For the latest version click CS339610