cancel
Showing results for 
Search instead for 
Did you mean: 

Error "Missing JWT Token for forwardAuthToken" When Using worker_threads/spawn in SAP CAP

nparaman
Explorer
0 Kudos

Hello SAP Community,

I am working on a CAPM application and am facing performance challenges related to high-volume data uploads. To address potential timeouts and enhance performance, I experimented with Node.js's worker_threads and spawn from the child_process module. The idea is to handle the data upload processes in parallel.

However, I encountered a recurring issue when making POST calls from within a worker thread or a spawned process. The error reported is "Missing JWT token for forwardAuthToken". This error does not occur when the same POST logic is executed directly within the service.

Here’s a brief overview of my approach:

  1. I used worker_threads/spawn to parallelize the data upload tasks.
  2. Inside each thread/process, I perform a POST request to handle the uploads.
  3. The POST requests inside the main service work perfectly fine, but when executed inside the worker thread or spawn process, it throws an error indicating a missing JWT token.

I suspect this might be related to the way authentication tokens are managed in CAP when using asynchronous modules like worker_threads or child_process.

Could anyone help clarify the correct approach to forwarding or managing JWT tokens in such scenarios, or suggest alternative strategies to handle high-volume data uploads in CAPM efficiently?

Thank you for your assistance!

View Entire Topic
martinstenzig
Contributor
0 Kudos

What are you uploading to? From a client to CAP or CAP to a backend system like SAP?