Skip to content

HTTP Status code is sometimes equal to -11 after successful post request. #9203

@ms-somanna

Description

@ms-somanna

Board

ESP32 Dev Board

Device Description

Custom Dev Board

Hardware Configuration

The following modules are attached to the board.

  • Rs485 to TTL converter module
  • RTC module
  • LTE module

Version

latest master (checkout manually)

IDE Name

Arduino IDE

Operating System

Windows 11

Flash frequency

40 Mhz

PSRAM enabled

yes

Upload speed

115200

Description

I'm fetching energy meter data from the RS485 module, converting it to Json objects and sending the Json data as payload in a http post request to Google Sheets. I'm using the HTTP status code returned by HTTP.GET() function to check if the request was successful or not. The problem is sometimes even after successfully adding the json data to google sheets, the http status code returned is -11. This obviously leads to assuming the request failed even though it succeeded.

Sketch

String url = "https://script.google.com/macros/s/"+GOOGLE_SCRIPT_ID+"/exec";
Serial.println(url);
Serial.println("Making a request");
http.begin(url, root_ca);     //Specify the URL and certificate
http.addHeader("Content-Type", "application/json");
httpCode = http.POST("[" + payload + "]"); 
http.end();

Debug Message

No error/debug messages were captured till now. I haven't yet made the code capture the HTTP response string either. Please do let me know if you require it.

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions