Unable to use TinyGSM to access a long URL

I'm running code on ESP32+A7670 that uses the TinyGSM library.
Part of that code attempts to POST to a URL:

TinyGsm modem(SerialAT);
//  ...
//  Code to initialize the modem
//  ...
String server_url = "https://xxxxxxxxxx.execute-api.eu-west-1.amazonaws.com/dev/path/element";
modem.https_begin();
if (!modem.https_set_url(server_url)) {
    Serial.println("Failed to set the URL");
    return;
}
String post_body = "";

int httpCode = modem.https_post(post_body);
if (httpCode != 200) {
    Serial.print("HTTP post failed ! error code = "); 
    Serial.println(httpCode); 
    return;
}

The attempt fails with an error code 715.

Two observations:

  • When running the code but using WiFi instead of the GSM modem, all works well
  • When running the code still using the GSM modem but with a shorter URL i.e httpbin.org, all works well

This leads me to wonder whether the issue is about the length of the URL and the Modem.

Could anybody shed some light on this?

That appears to be a string size limitation. Increase that if you can and it should be OK.

How would I go about increasing the string size limit?

That should be in the TinyGSM library. I have not used the part so I am not positive. I have seen similar problems in other libraries.