Giter Site home page Giter Site logo

Comments (7)

dherault avatar dherault commented on May 28, 2024

Hi @peebles thanks for noticing this.

Are you saying that AWS always adds a "payload" key to the "event" object when using the POST method? If yes this is a major bug of the plugin.

Here's a quick fix to your pb, until we solve it globally:

"requestTemplates": {
    "application/json": {
        "payload": "$input.json('$')",
        "sourceIp": "$context.identity.sourceIp"
    }
}

from serverless-offline.

peebles avatar peebles commented on May 28, 2024

No, that's not what I am saying. I'm saying that given the s-function.json I showed, if I post { "foo": "bar" } to amazon, I get event.foo==bar, but in offset plugin I get event.foo==undefined.

On Jun 2, 2016, at 1:01 AM, David HΓ©rault [email protected] wrote:

Hi @peebles thanks for noticing this.

Are you saying that AWS always adds a "payload" key to the "event" object when using the POST method? If yes this is a major bug of the plugin.

Here's a quick fix to your pb, until we solve it globally:

"requestTemplates": {
"application/json": {
"payload": "$input.json('$')",
"sourceIp": "$context.identity.sourceIp"
}
}
β€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

from serverless-offline.

dherault avatar dherault commented on May 28, 2024

Thanks, this is officially a bug now πŸ˜‰
Will work on it.

from serverless-offline.

dherault avatar dherault commented on May 28, 2024

Ok what about now, v2.6.0

from serverless-offline.

cspeer avatar cspeer commented on May 28, 2024

I'm running 2.6.0 and still my event object == {"isOffline":true}:/
Also the payload workaround does not work either.

from serverless-offline.

dbunker avatar dbunker commented on May 28, 2024

@cspeer, your debug indicates payload is empty and requestTemplate is undefined, shown from here. This is likely due to a missing application/json as Content-Type header. If that doesn't help, could you post the code you're using for fetch and your s-function.json file?

from serverless-offline.

cspeer avatar cspeer commented on May 28, 2024

@dbunker Yes, you were right, I forgot to set the appropriate header. Everything is fine now!

from serverless-offline.

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.