Internal server error - Cannot read properties of undefined (reading 'length')

I'm attempting to make a POST request, but I keep encountering this error: 'Internal server error - Cannot read properties of undefined (reading 'length').' The request has a raw body with a couple of simple data points, nothing unusual. I've tried the same request in Postman, and it works fine there.

Please help :worried:

Hi @Tabella,

It looks like the query is fine. I tested a similar query and it works. It maybe something to do with your response. Would you mind sharing a sample response from the end point?

Hi! Sure, thank you.

I have double-checked the URL, the parameters, everything. However, I still receive that response from Retool, but the same request works fine in Postman.

Hmm those looks fine. If you click on the "API Request" tab on Retool UI (it's next to "Response"), what do you see? It'll also help to share a screenshot of that.

"request": {
"url": "",
"method": "POST",
"body": "{"id":"SaintPeter-Mertzon","parentId":"Diocese-4","childTypeName":"Parish"}",
"headers": {
"User-Agent": "Retool/2.0 (+",
"Authorization": "---sanitized---",
"ot-baggage-requestId": "undefined",
"x-datadog-trace-id": "8700139179157712507",
"x-datadog-parent-id": "8903674363730136149",
"x-datadog-sampling-priority": "-1",
"traceparent": "00-000000000000000078bd1a7cf6276e7b-7b9034a8fde30c55-00",
"tracestate": "dd=s:-1",
"X-Retool-Forwarded-For": ""
"response": {
"data": {
"status": "error",
"message": "Internal server error - Cannot read properties of undefined (reading 'length')"
"headers": {
"server": [
"report-to": [
"reporting-endpoints": [
"nel": [
"connection": [
"x-powered-by": [
"access-control-allow-origin": [
"content-type": [
"application/json; charset=utf-8"
"content-length": [
"etag": [
"date": [
"Wed, 10 Apr 2024 14:47:45 GMT"
"via": [
"1.1 vegur"
"status": 500,
"statusText": "Internal Server Error"

@Tabella It looks like the error comes from your server (status: 500 in the metadata). The body looks as expected. The request we send looks normal as well. I suspect it can be some default headers we have is missing or not as expected. Like I don't see "application/json" type in the body.

  • Can you change the body format from "RAW" to "JSON"?
  • Can you check your server on heroku to see if there is any crash log related to the error Cannot read properties of undefined (reading 'length')"?

Changing from RAW to JSON worked!!! Thank you soooooo much!!!!