Code Monkey home page Code Monkey logo

Comments (2)

avirtuos avatar avirtuos commented on August 30, 2024

It is my understanding that the HTTP Status Code reflects the state of the call to AWS Lambda, not the success/failure of the code running within the Lambda invocation.

The status code in the API response doesn't reflect function errors. Error codes are reserved for errors that prevent your function from executing, such as permissions errors, limit errors, or issues with your function's code and configuration. For example, Lambda returns TooManyRequestsException if executing the function would cause you to exceed a concurrency limit at either the account level (ConcurrentInvocationLimitExceeded) or function level (ReservedFunctionConcurrentInvocationLimitExceeded).

from https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html

I've seen the Lambda java client re-throw uncaught exceptions from the Lambda function invocation as a LambdaInvocationException. This seems to suggest that there is some application level protocol for serializing the exception from within the Lambda invocation.

In fact, this page seems to show how Lambda functions (written in Java) handle uncaught exceptions:

Expected payload format when encountering an uncaught exception:

{
  "errorMessage": "Name John Doe is invalid. Exception occurred...",
  "errorType": "java.lang.Exception",
  "stackTrace": [
    "example.Hello.handler(Hello.java:9)",
    "sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)",
    "sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)",
    "sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)",
    "java.lang.reflect.Method.invoke(Method.java:497)"
  ]
}

from this page: https://docs.aws.amazon.com/lambda/latest/dg/java-exceptions.html

Alternatively, many of the docs seems to suggest you can get custom HTTP Status Codes by using API Gateway in front of your Lambda function. It has been a while since I looked closely at API Gateway by they did not support sufficiently long timeouts or request/response payload sizes to be advisable in conjunction with Query Federation.

I'll see what else I can find but I also don't see a way to affect the HTTP Status Codes from the Java interface our Lambda's implement.

from aws-athena-query-federation.

avirtuos avatar avirtuos commented on August 30, 2024

Closing per chat with @grundprinzip . @grundprinzip please reopen if you are still blocked.

from aws-athena-query-federation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.