Skip to content

LAMBDA_RUNTIME Failed to get next invocation. No Response from endpoint #26

Open

Description

@samuelkeenvil

Hi guys!

I just writing some lambdas in c++ using the aws-lambda-cpp

i checking my log and i have this Error in my log:

[ERROR] [1553201323958] LAMBDA_RUNTIME Failed to get next invocation. No Response from endpoint

do you know if this is normal? because i check and debug my code but i don't found nothing.

what my lambda do is extract the body from SQS request, and make a slack post with the message.

for that i use curl and have the ssl disable

other thing is i dont see a print message that i have in the main after the

invocation_response handler(invocation_request const &req) {
return invocation_response::success();
}

this is my main:

int main() {
    //use AWS namespace and libs
    using namespace Aws;
    //set the log for the sdk
    SDKOptions options;
    //init AWS API
    InitAPI(options);
    {
        auto handler_function = [](aws::lambda_runtime::invocation_request const &req) {
            return handler(req);
        };
        run_handler(handler_function);
    }
    // shutdown the aws api
    std::cout << "ShutdownAPI api" << "\n";
    ShutdownAPI(options);

    std::cout << "exit" << "\n";

    //exit
    return 0;
}

i dont see the Shutdown and exit print in the cloud-watch log

so the question
the ShutdownAPI(options); and the return 0 is never called?

thank you!!!

Activity

  1. marcomagdy commented on Apr 9, 2019

    @marcomagdy
    Contributor

    The I/O is buffered. You should see the messages if you add std::cout.flush() at the end, or append << std::endl which has the side-effect of flushing.

  2. marcomagdy commented on Apr 9, 2019

    @marcomagdy
    Contributor

    Are you seeing the message [ERROR] [1553201323958] LAMBDA_RUNTIME Failed to get next invocation. No Response from endpoint in your logs on every invocation? or sometimes?
    I'd like to get more data on this to diagnose what's happening.

  3. samuaz commented on Apr 24, 2019

    @samuaz

    @marcomagdy sorry for delay, this is my personal github account, i see this in every invocation, "all works fine" but in see that message in every invocation, let me know what data you need if you want i can share the code of my function

  4. webbnh commented on Jul 3, 2019

    @webbnh

    "all works fine" but in see that message in every invocation

    Me, too.

    Every Lambda invocation starts out like this:

    Lambda function invocation starting.
    [WARN] 2019-07-03 22:05:46 FileSystemUtils [139730358032256] Home dir not stored in environment, trying to fetch manually from the OS.
    Lambda function calling Lambda runtime.
    START RequestId: cb1f23f2-4df9-4093-985c-d2a49d2f9354 Version: $LATEST
    [ERROR] [1562191546320] LAMBDA_RUNTIME Failed to get next invocation. No Response from endpoint
    Entering my_handler.
    [...]
    

    And, for Lambda invocations which get reused, it shows up on the next invocation too:

    [...]
    END RequestId: f1be42e8-84e2-4ca5-b877-3ac84d33b9d1
    REPORT RequestId: f1be42e8-84e2-4ca5-b877-3ac84d33b9d1 Init Duration: 202.89 ms Duration: 9216.62 ms Billed Duration: 9500 ms Memory Size: 256 MB Max Memory Used: 80 MB
    START RequestId: 384e8a2e-2230-4642-81db-c91f725f8e69 Version: $LATEST
    [ERROR] [1562191572175] LAMBDA_RUNTIME Failed to get next invocation. No Response from endpoint
    Entering my_handler.
    [...]
    

    Also, the warning:

    [WARN] 2019-07-03 22:05:44 FileSystemUtils [140509995136896] Home dir not stored in environment, trying to fetch manually from the OS.
    

    shows up at various points, as well, apparently without negative effect.

  5. added
    wontfix
    and removed
    wontfix
    on Sep 14, 2019
  6. marcomagdy commented on Sep 14, 2019

    @marcomagdy
    Contributor

    @webbnh the last warning is from the AWS SDK. Not Lambda.
    @samuaz I'm unable to reproduce the problem, and I feel it's yet-another-libcurl-problem that does not happen when using a different libcurl version.

    I'm going to resolve all the libcurl problems by bundling a good version with this runtime.

  7. added
    libcurl
    on Sep 14, 2019
  8. deepak-1530 commented on Dec 9, 2019

    @deepak-1530

    @marcomagdy Curious to see when this will be resolved. I am also stuck at the same spot

  9. marcomagdy commented on Dec 9, 2019

    @marcomagdy
    Contributor

    The problem is I need to reproduce the problem and I haven't been able to so far.
    What version of libcurl are you using?

    If a newer version of libcurl resolves this issue, I will put up a PR that builds a known good version of libcurl and link to it as a CMake option.
    But I need your help to make sure that's the root cause first.

  10. deepak-1530 commented on Dec 9, 2019

    @deepak-1530

    I am using version 7.47.0

  11. marcomagdy commented on Dec 9, 2019

    @marcomagdy
    Contributor

    Try building the latest release of libcurl from source and install it somewhere on your system that doesn't conflict with your OS (pass --prefix /home//my-libcurl-install to the configure command) and then build the runtime normally and pass -DCMAKE_PREFIX_PATH="/home/<username>/my-libcurl-install" to your CMake command.

    Meanwhile, I will try to reproduce with libcurl 7.47.0
    Which distro does that come as a default with btw?

  12. webbnh commented on Dec 10, 2019

    @webbnh
    # curl-config --version
    libcurl 7.47.0
    
    # uname -a
    Linux aa6d84702054 4.14.131-linuxkit #1 SMP Fri Jul 19 12:31:17 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
    

    That's a Docker container built from ubuntu:16.04 with apt-get install -y libcurl4-openssl-dev.

  13. david-wb commented on Dec 16, 2021

    @david-wb

    Any luck with this? I'm having the same issue in a python lambda.

  14. AltafHussain4748 commented on Aug 18, 2022

    @AltafHussain4748

    @david-wb

    How did you solve that?

  15. hbobenicio commented on Aug 20, 2022

    @hbobenicio
    Contributor

    I'm trying to run the demo example from the docs and I'm facing the same error. here is what I found:
    First, I got this error:

    [ERROR] [1660998782441] LAMBDA_RUNTIME Failed to get next invocation. No Response from endpoint
    [ERROR] [1660998782581] LAMBDA_RUNTIME Failed to get next invocation. No Response from endpoint
    [ERROR] [1660998782664] LAMBDA_RUNTIME Failed to get next invocation. No Response from endpoint
    [ERROR] [1660998782664] LAMBDA_RUNTIME Exhausted all retries. This is probably a bug in libcurl v7.68.0 Exiting!
    

    After I grep the runtime source code, I found that this is comming from here:

    logging::log_error(LOG_TAG, "Failed to get next invocation. No Response from endpoint");

    But the actual CURL "error" is just logged as a debug level log (which IMHO shouldn't be a debug level. it should be an error level message. No error context must be truncated...)
    logging::log_debug(LOG_TAG, "CURL returned error code %d - %s", curl_code, curl_easy_strerror(curl_code));

    So after recompiling my lambda with -DAWS_LAMBDA_LOG=2 (maybe it would be better to have a runtime log level configuration instead of needing to recompile it, but well... let's focus on the problem here...) I got the missing context:

    [INFO] [1660999392927] LAMBDA_RUNTIME Initializing the C++ Lambda Runtime version 0.0.0
    [DEBUG] [1660999392928] LAMBDA_RUNTIME Making request to http:///2018-06-01/runtime/invocation/next
    [DEBUG] [1660999392960] LAMBDA_RUNTIME CURL DBG: Could not resolve host: 2018-06-01
    
    [DEBUG] [1660999392960] LAMBDA_RUNTIME CURL DBG: Closing connection 0
    
    [DEBUG] [1660999392960] LAMBDA_RUNTIME Completed request to http:///2018-06-01/runtime/invocation/next
    [DEBUG] [1660999392960] LAMBDA_RUNTIME CURL returned error code 6 - Couldn't resolve host name
    [ERROR] [1660999392960] LAMBDA_RUNTIME Failed to get next invocation. No Response from endpoint
    [DEBUG] [1660999392960] LAMBDA_RUNTIME Making request to http:///2018-06-01/runtime/invocation/next
    [DEBUG] [1660999392988] LAMBDA_RUNTIME CURL DBG: Could not resolve host: 2018-06-01
    
    [DEBUG] [1660999392988] LAMBDA_RUNTIME CURL DBG: Closing connection 1
    
    [DEBUG] [1660999392988] LAMBDA_RUNTIME Completed request to http:///2018-06-01/runtime/invocation/next
    [DEBUG] [1660999392988] LAMBDA_RUNTIME CURL returned error code 6 - Couldn't resolve host name
    [ERROR] [1660999392988] LAMBDA_RUNTIME Failed to get next invocation. No Response from endpoint
    [DEBUG] [1660999392988] LAMBDA_RUNTIME Making request to http:///2018-06-01/runtime/invocation/next
    [DEBUG] [1660999393011] LAMBDA_RUNTIME CURL DBG: Could not resolve host: 2018-06-01
    
    [DEBUG] [1660999393011] LAMBDA_RUNTIME CURL DBG: Closing connection 2
    
    [DEBUG] [1660999393011] LAMBDA_RUNTIME Completed request to http:///2018-06-01/runtime/invocation/next
    [DEBUG] [1660999393011] LAMBDA_RUNTIME CURL returned error code 6 - Couldn't resolve host name
    [ERROR] [1660999393011] LAMBDA_RUNTIME Failed to get next invocation. No Response from endpoint
    [ERROR] [1660999393011] LAMBDA_RUNTIME Exhausted all retries. This is probably a bug in libcurl v7.68.0 Exiting!
    

    Clearly requesting http:///2018-06-01/runtime/invocation/next would never going to work (and it's not a curl issue either). After checking the source how I set's this URL I found that the runtime creates this endpoint based on the environment variable AWS_LAMBDA_RUNTIME_API which, in my case, is clearly empty.

    if (auto* ep = std::getenv("AWS_LAMBDA_RUNTIME_API")) {

    I'm wondering if this environment variable is required for this runtime to work. Because if it is, we get no clue about it just from the logs... Maybe this runtime could improve the logging about this of better handling the endpoint configuration/setting process to avoid this confusion.

  16. marcomagdy commented on Aug 20, 2022

    @marcomagdy
    Contributor

    That environment variable is set by AWS. See https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime

    I am not 100% sure how that environment variable is empty for you.

  17. hbobenicio commented on Aug 20, 2022

    @hbobenicio
    Contributor

    Thanks for the tip, marcomagdy!
    Just tried running locally on my machine. That explains a lot =)
    Sorry if this is dummy... I was just curious what would happen before uploading it to AWS. So I got these messages and found this issue. I'm a total beginner on aws lambda too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    libcurl

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions