Hi everyone,
I'm trying to set up a simple proxy using API Action in a Node.js project.
My frontend sends a GET request to a Server Connect endpoint, and it needs to forward that request to my Python backend.
My frontend is successfully sending the following custom header:
X-Project-Key: pk_test_12345...
In my Server Connect API Action step, I am mapping the header like this:
Name: X-Project-Key
Value: {{$_SERVER.HTTP_X_PROJECT_KEY}} (I also tried $_HEADERS.x_project_key)
However, the API Action instantly crashes before the request even leaves Wappler. The Node.js server throws this 500 error:
```
{ "status": "500", "code": "ERR_HTTP_INVALID_HEADER_VALUE", "message": "Invalid value \"undefined\" for header \"X-Project-Key\"", "stack": "TypeError [ERR_HTTP_INVALID_HEADER_VALUE]: Invalid value \"undefined\" for header \"X-Project-Key\"..." }
```
What I have tried so far to fix it:
-
Using .default("") e.g., {{$_SERVER.HTTP_X_PROJECT_KEY.default("")}}. This prevents the 500 crash, but it sends an empty string to my Python backend, which rejects it because the key is missing.
-
Using $_HEADERS.x_project_key instead of $_SERVER. Same result.
-
Creating intermediate "Set Value" steps before the API Action. Same result.
Is there a specific way we must format or access custom incoming headers that contain dashes (X-Project-Key) in Node.js projects so that the API Action evaluates them correctly instead of returning undefined?
Any guidance would be much appreciated!
