Giter Club home page Giter Club logo

Comments (6)

Andrea-Scuderi avatar Andrea-Scuderi commented on June 8, 2024

To troubleshoot your code I suggest to use the function log() as implemented in HelloWorld.

Unhandled - The runtime didn't handle the error. For example, the function ran out of memory or timed out.

from aws-lambda-swift-sprinter.

Andrea-Scuderi avatar Andrea-Scuderi commented on June 8, 2024

For AsyncCodableLambda you need to call the completion handler. Can you provide the code?

Are you sure the db is reachable from the AWS Lambda?
You need to be sure that the Postgres library you are using is based on SwiftNIO 2.0.

from aws-lambda-swift-sprinter.

mihirpmehta avatar mihirpmehta commented on June 8, 2024

Hi,

I am using HellowWorld Example's sample code only for AsyncLambda ... Just one line of change in main.swift

sprinter.register(handler: "helloWorld4", lambda: asyncDictLambda)
uncommented above line and commented syncLambda line

And yes it calls completionHandler inside it.

This is the code

let asyncLambda: AsyncCodableLambda<Event, Response> = { event, _, completion in
    let message = "Hello World! Hello \(event.name)!"
    return completion(.success(Response(message: message)))
}
let asyncDictLambda: AsyncDictionaryLambda = { dictionary, _, completion in
    var result = [String: Any]()
    if let name = dictionary["name"] as? String {
        let message = "Hello World! Hello \(name)!"
        result["message"] = message
    } else {
        completion(.failure(MyLambdaError.invalidEvent))
    }
    completion(.success(result))
}

returns exact same error message

Thanks

from aws-lambda-swift-sprinter.

mihirpmehta avatar mihirpmehta commented on June 8, 2024

just to clarify any confusion. It has nothing to do with Database connection or anything. It's the default code that is given in the main.swift file for asyncLambda i am referring to.

Thanks

from aws-lambda-swift-sprinter.

Andrea-Scuderi avatar Andrea-Scuderi commented on June 8, 2024

@mihirpmehta Have you registered the Handler HelloWorld.helloWorld4 ?
If not you can just reuse the one you have registered:
sprinter.register(handler: "helloWorld", lambda: asyncDictLambda)

from aws-lambda-swift-sprinter.

mihirpmehta avatar mihirpmehta commented on June 8, 2024

Oh. I miss it. I didn't change it in makefile. Thanks a ton

from aws-lambda-swift-sprinter.

Related Issues (17)

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.