Compilation error: 'request' was not declared in this scope

#include <ESPAsyncWebServer.h>

void WiFi_begin();
void process_incoming_data();


// Create an instance of the server
AsyncWebServer server(HTTP_port);


void setup() {
  // Start the serial communication
  Serial.begin(serial_comms_speed);

  // Connect to Wi-Fi
  while (WiFi.status() != WL_CONNECTED) {
    WiFi_begin();
  }

  // Route for handling any HTTP request to '/'
  server.on("/", HTTP_ANY, {
    // Wait for the entire message to be received
    request->onBody(request {
      // Process the incoming data here
      process_incoming_data();
    });
  });



    // Send a response
    //request->send(200, "text/plain", "Hello, world");
  });

  // Start the server
  server.begin();
}

Compilation error: 'request' was not declared in this scope

How do I get 'request' to be recognized?

onBody is definitely part of ESPAsyncWebServer, but maybe not this part?

How do I get server.on to wait until the incoming packet has completed transmission before calling process_incoming_data()?

        request->onBody(request {

Look carefully at this line of code. Does it look correct ?

I have no idea. I haven't found any samples like this, and there doesn't seem to be a listing of Methods and Properties anywhere.

My point was that the parameter of the call to the onBody() function looks very odd. I don't know whether it is correct, hence my question

It looks like request->onBody is being treated like a function, complete with parenthesis and brackets. The close parenthesis and close bracket happens farther down. Strange perhaps, but plausible in this environment.

I went through my notes and tried request->onRequestBody but got the same result.

Turned into a single line of code it looks even odder

    server.on("/", HTTP_ANY, {request->onBody(request {process_incoming_data();});});

The curly brackets and semicolons look particularly out of place

Please post the full error message

/Users/user/Robot/programming/TCPServer1/TCPServer1.ino: In function 'void setup()':
/Users/user/Robot/programming/TCPServer1/TCPServer1.ino:28:5: error: 'request' was not declared in this scope
request->onRequestBody(request {
^~~~~~~
/Users/user/Robot/programming/TCPServer1/TCPServer1.ino:28:5: note: suggested alternative: 'renameat'
request->onRequestBody(request {
^~~~~~~
renameat
/Users/user/Robot/programming/TCPServer1/TCPServer1.ino:28:35: error: expected ')' before '{' token
request->onRequestBody(request {
~ ^~
)
/Users/user/Robot/programming/TCPServer1/TCPServer1.ino:31:7: error: expected '}' before ';' token
});
^
/Users/user/Robot/programming/TCPServer1/TCPServer1.ino:26:28: note: to match this '{'
server.on("/", HTTP_ANY, {
^
/Users/user/Robot/programming/TCPServer1/TCPServer1.ino:31:7: error: expected ')' before ';' token
});
^
)
/Users/user/Robot/programming/TCPServer1/TCPServer1.ino:26:12: note: to match this '('
server.on("/", HTTP_ANY, {
^
/Users/user/Robot/programming/TCPServer1/TCPServer1.ino: At global scope:
/Users/user/Robot/programming/TCPServer1/TCPServer1.ino:32:4: error: expected unqualified-id before ')' token
});
^
/Users/user/Robot/programming/TCPServer1/TCPServer1.ino:38:3: error: expected declaration before '}' token
});
^
Multiple libraries were found for "WiFi.h"
Used: /Users/user/Library/Arduino15/packages/esp32/hardware/esp32/2.0.14/libraries/WiFi
Not used: /Users/user/Robot/programming/libraries/WiFi
Not used: /Users/user/Robot/programming/libraries/WiFiNINA
exit status 1

Compilation error: 'request' was not declared in this scope

I appreciate your analysis, however, when I use;

server.on("/", HTTP_ANY, [] (AsyncWebServerRequest *request) {
    // Wait for the entire message to be received
    request->onBody( {

I get: /Users/user/Robot/programming/TCPServer1/TCPServer1.ino: In lambda function:
/Users/user/Robot/programming/TCPServer1/TCPServer1.ino:29:14: error: 'class AsyncWebServerRequest' has no member named 'onBody'
request->onBody( {
^~~~~~
/Users/user/Robot/programming/TCPServer1/TCPServer1.ino:31:30: error: expected '}' before ';' token
process_incoming_data();
^
/Users/user/Robot/programming/TCPServer1/TCPServer1.ino:29:22: note: to match this '{'
request->onBody( {
^
/Users/user/Robot/programming/TCPServer1/TCPServer1.ino:31:30: error: expected ')' before ';' token
process_incoming_data();
^
)
/Users/user/Robot/programming/TCPServer1/TCPServer1.ino:29:20: note: to match this '('
request->onBody( {
^
/Users/user/Robot/programming/TCPServer1/TCPServer1.ino: At global scope:
/Users/user/Robot/programming/TCPServer1/TCPServer1.ino:33:2: error: expected unqualified-id before ')' token
});
^
/Users/user/Robot/programming/TCPServer1/TCPServer1.ino:38:3: error: expected declaration before '}' token
});
^
Multiple libraries were found for "WiFi.h"
Used: /Users/user/Library/Arduino15/packages/esp32/hardware/esp32/2.0.14/libraries/WiFi
Not used: /Users/user/Robot/programming/libraries/WiFiNINA
Not used: /Users/user/Robot/programming/libraries/WiFi
exit status 1

Compilation error: 'class AsyncWebServerRequest' has no member named 'onBody'

All of the samples with send are for sending back responses. That's not what I want. I want to call process_incoming_data() after the transmission completes. Maybe onBody is the wrong term. What is the correct term?

So what do I use for a trigger? What line waits until the incoming transmission is complete before it runs my function?

Change that to: What command waits until the incoming transmission is complete before it runs my function?

Asynchronous means the system will trigger the interrupt as soon as it sees data. That is not proof the transmission has completed. What if you have a long transmission coming in and your process grabs it before the transmission is complete? Sure, the system will re-trigger when the next batch comes in, but how does your system distinguish between one stream which has been broken up, and two separate streams?

I've been farther into the documentation for this library than I ever wanted to be. I'm going to go with your assertion the lambda doesn't get called until after the transmission is complete.