Git Product home page Git Product logo

Comments (6)

howardjohn avatar howardjohn commented on June 13, 2024

The Lambda function will accept a ProxyRequest which is the format that API Gateway will send requests with proxy integration enabled. If requests aren't sent through API Gateway, they would need to manually be formatted to include httpMethod, headers, etc which is likely the error you are experiencing.

This is a pretty common issue so I think I'll update the error message to explain this.

from scala-server-lambda.

romasilimcano avatar romasilimcano commented on June 13, 2024

Thanks. Using sam local it does create a APIGatewayProxyRequestEvent which has the httpMethod and headers. I do not know if I am missing out something, I have not tried servless for local testing so do not know if it is different.

from scala-server-lambda.

howardjohn avatar howardjohn commented on June 13, 2024

Ok, I don't think SAM Local is the issue then.

Looking at the error again, it is coming from Jackson, which lambda uses internally to process json inputs. So it is trying to marshall it into a ProxyRequest. What should be happening is it turns it into an InputStream then this library uses Circe to turn it into a ProxyRequest. I think this is happening due to setting the wrong handler in Lambda. It should be this function not this function, so it should look something like <PACKAGE_NAME>.Route$EntryPoint::handle. What handler are you using?

from scala-server-lambda.

romasilimcano avatar romasilimcano commented on June 13, 2024

Thanks a lot for you help. It did work with function, I was using handleRequest. But now I am running into a fs2 library issue,it has nothing to do with this library but if you do not mind can you tell me what version of fs2 library you are using. For me it is downloading fs2-core_2.12_1.0.0.jar

java.lang.NoSuchMethodError: fs2.Stream$InvariantOps$.through$extension(Lfs2/internal/FreeC;Lscala/Function1;)Lfs2/internal/FreeC;
at io.github.howardjohn.lambda.http4s.Http4sLambdaHandler$.encodeBody(Http4sLambdaHandler.scala:63)
at io.github.howardjohn.lambda.http4s.Http4sLambdaHandler$.$anonfun$parseRequest$5(Http4sLambdaHandler.scala:53)
at io.github.howardjohn.lambda.http4s.Http4sLambdaHandler$.$anonfun$parseRequest$5$adapted(Http4sLambdaHandler.scala:53)
at scala.Option.map(Option.scala:146)
at io.github.howardjohn.lambda.http4s.Http4sLambdaHandler$.$anonfun$parseRequest$2(Http4sLambdaHandler.scala:53)
at scala.util.Either.map(Either.scala:350)
at io.github.howardjohn.lambda.http4s.Http4sLambdaHandler$.$anonfun$parseRequest$1(Http4sLambdaHandler.scala:47)
at scala.util.Either.flatMap(Either.scala:338)
at io.github.howardjohn.lambda.http4s.Http4sLambdaHandler$.io$github$howardjohn$lambda$http4s$Http4sLambdaHandler$$parseRequest(Http4sLambdaHandler.scala:46)
at io.github.howardjohn.lambda.http4s.Http4sLambdaHandler.handleRequest(Http4sLambdaHandler.scala:15)
at com.test.EntryPoint.handleRequest(Test.scala:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)

from scala-server-lambda.

howardjohn avatar howardjohn commented on June 13, 2024

fs2 is pulled in from http4s. The fs2 version they use can be found at https://http4s.org/versions/.

If you use 0.3.1 of this library it uses http4s 18, which uses an older fs2. 0.4-SNAPSHOT uses the newer http4s 20.

from scala-server-lambda.

romasilimcano avatar romasilimcano commented on June 13, 2024

Thank you very much for all your help. And thanks for creating this fantastic library.

from scala-server-lambda.

Related Issues (7)

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.