Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Richard Tan
    @richardtapendium
    If it's still not working, we can investigate further
    Adam Hynes
    @giveadamakick

    Hi! My serverless app does some request template mapping to get the raw body received from a Stripe webhook (it needs the raw body for verification by signing). The request template mapping works in "real" API gateway in my dev environment. When running locally with serverless-offline, I'm getting an undefined event being passed to my lambda function. Here's how my config looks:

      sessionCompletedStripeWebhook:
        handler: src/session-completed-stripe-webhook/handler.sessionCompletedStripeWebhook
        events:
          - http: 
              path: /stripe/session-completed
              method: post
              cors: true
              integration: lambda
              request:
                template:
                  application/json: '{ "rawStripeEvent" : "$util.escapeJavaScript($input.body).replaceAll("\\''", "''")", "stripeSignature" : "$input.params(''Stripe-Signature'')" }'

    Does anyone know if serverless offline supports inline request template mapping config like this? In the README, there's a section on using velocity templates. I gave that a shot but it also didn't work, but without a good example I wasn't sure if I was doing it right.

    Adam Hynes
    @giveadamakick
    I managed to get it working with a separate velocity template as described in that page. It seems however that it's not possible to get the raw body untouched in a way that satisfies Stripe's verification when running with serverless-offline. The same problem has been encountered by others: dherault/serverless-offline#522.
    Xitij Ritesh Patel
    @HorizonXP
    @richardtapendium Thanks, I don't know how I missed the package.json version before, but that resolved it!
    David Hérault
    @dherault
    I'm back
    :)
    mamhaidly
    @mamhaidly
    hi is it possible to run the sls offline start command on a file named other than serverless.yml ?
    David Hérault
    @dherault
    @mamhaidly This is not an issue with serverless offline but with the serverless frameworks. I do not think so
    dl748
    @dl748
    I currently use serverless.json files instead of the yml files
    Sajith Neyomal
    @sajithneyo

    Guys how to use vscode-debugger with serverless-offline? My current configurations(launch.json) is bellow,

    {
        "version": "0.2.0",
        "configurations": [
            {
                "type": "node",
                "request": "launch",
                "name": "Launch Serverless Offline",
                "program": "${workspaceRoot}/node_modules/serverless/bin/serverless.js",
                "args": [
                    "offline",
                    "--noTimeout",
                    "--dontPrintOutput",
                    "--stage=local",
                    "-P",
                    "4000",
                    "--aws-profile=#PROFILENAME#"
                ],
                "sourceMaps": true,
                "runtimeArgs": ["--lazy"],
                "outFiles": ["${workspaceFolder}/**/services/user/build/**/*.js"],
                "protocol": "inspector",
                "runtimeExecutable": "node",
                "env": {
                    "SLS_DEBUG": "*"
                },
                "windows": {
                    "program": "${workspaceRoot}\\node_modules\\serverless\\bin\\serverless.js"
                }
            }
        ]
    }

    it throws following error.

    Serverless Error ---------------------------------------
    node_modules/serverless/lib/classes/Error.js:12
    
    node_modules/serverless/lib/classes/Error.js:12
      ServerlessError: Serverless command "offline" not found. Did you mean "config"? Run "serverless help" for a list of all available commands.
    Helmut Kian Rohrbacher
    @helmutkian
    Hi all, I'm getting a MODULE_NOT_FOUND error from InProcessRunner.js when trying to use Lambda#invoke on another function running in my serverless offline environment. It seems instead of using HTTP, it's trying to load the module from src/
    I am using Typescript and Webpack
    Helmut Kian Rohrbacher
    @helmutkian
    Ah adding serverless-plugin-typescript to my plugins resolved the issue
    dl748
    @dl748
    if you use serverless-plugin-typescript then webpack isn't needed
    bregard
    @bregard
      Error --------------------------------------------------
    
      Error: Cannot find module 'serverless-offline/src/functionHelper'
      Require stack:
      - /Users/bregard/cartoon-play-api/source/nodejs/.serverless_plugins/plugin-local-invoke.js
      - /usr/local/Cellar/serverless/1.78.1/libexec/lib/node_modules/serverless/lib/classes/PluginManager.js
      - /usr/local/Cellar/serverless/1.78.1/libexec/lib/node_modules/serverless/lib/Serverless.js
      - /usr/local/Cellar/serverless/1.78.1/libexec/lib/node_modules/serverless/scripts/serverless.js
      - /usr/local/Cellar/serverless/1.78.1/libexec/lib/node_modules/serverless/bin/serverless.js
          at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
          at Function.Module._load (internal/modules/cjs/loader.js:840:27)
          at Module.require (internal/modules/cjs/loader.js:1019:19)
          at require (internal/modules/cjs/helpers.js:77:18)
          at Object.<anonymous> (/Users/bregard/cartoon-play-api/source/nodejs/.serverless_plugins/plugin-local-invoke.js:3:26)
          at Module._compile (internal/modules/cjs/loader.js:1133:30)
          at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
          at Module.load (internal/modules/cjs/loader.js:977:32)
          at Function.Module._load (internal/modules/cjs/loader.js:877:14)
          at Module.require (internal/modules/cjs/loader.js:1019:19)
          at require (internal/modules/cjs/helpers.js:77:18)
          at requireServicePlugin (/usr/local/Cellar/serverless/1.78.1/libexec/lib/node_modules/serverless/lib/classes/PluginManager.js:21:14)
          at /usr/local/Cellar/serverless/1.78.1/libexec/lib/node_modules/serverless/lib/classes/PluginManager.js:133:20
          at Array.map (<anonymous>)
          at PluginManager.resolveServicePlugins (/usr/local/Cellar/serverless/1.78.1/libexec/lib/node_modules/serverless/lib/classes/PluginManager.js:130:8)
          at PluginManager.loadAllPlugins (/usr/local/Cellar/serverless/1.78.1/libexec/lib/node_modules/serverless/lib/classes/PluginManager.js:117:15)
          at /usr/local/Cellar/serverless/1.78.1/libexec/lib/node_modules/serverless/lib/Serverless.js:101:35
          at tryCatcher (/usr/local/Cellar/serverless/1.78.1/libexec/lib/node_modules/serverless/node_modules/bluebird/js/release/util.js:16:23)
          at Promise._settlePromiseFromHandler (/usr/local/Cellar/serverless/1.78.1/libexec/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:547:31)
          at Promise._settlePromise (/usr/local/Cellar/serverless/1.78.1/libexec/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:604:18)
          at Promise._settlePromise0 (/usr/local/Cellar/serverless/1.78.1/libexec/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:649:10)
          at Promise._settlePromises (/usr/local/Cellar/serverless/1.78.1/libexec/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:729:18)
          at Promise._fulfill (/usr/local/Cellar/serverless/1.78.1/libexec/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:673:18)
          at Promise._settlePromise (/usr/local/Cellar/serverless/1.78.1/libexec/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:617:21)
          at Promise._settlePromise0 (/usr/local/Cellar/serverless/1.78.1/libexec/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:649:10)
          at Promise._settlePromises (/usr/local/Cellar/serverless/1.78.1/libexec/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:729:18)
          at Promise._fulfill (/usr/local/Cellar/serverless/1.78.1/libexec/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:673:18)
          at Promise._resolveCallback (/usr/local/Cellar/serverless/1.78.1/libexec/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:466:57)
          at Promise._settlePromiseFromHandler (/usr/local/Cellar/serverless/1.78.1/libexec/lib/node_modules/serverless/node_modules/bluebird/js/release/promise.js:559:17)
          at Promise._settlePromise (/usr/local/Cellar/server
    Just running serverless --version in my project... any ideas?
    version 6.5.0 of serverless-offline...
    John Noel Victorino
    @jnoelvictorino
    Hello, I have a question about accessing data from a Lambda Function (only without API Gateway) and Lambda Function (behind API Gateway). When I tried to access the JSON payload from behind an API Gateway, I can access it as event.body. But without an API Gateway (directly via Lambda), I can access the JSON payload as event. Would there be a way to access JSON payload as event.body only?
    Kevin Menhinick
    @kevbot-git
    Hi team, does anyone have any tips for contributing to serverless offline? I'm trying to make a test project use my locally-cloned serverless-offline but can't seem to get it to use my builds of it
    If anyone can take me through it I'd be happy to document the process in the Contributing section of the README
    Kevin Menhinick
    @kevbot-git
    Sorry, just found the file that tells me all about that :sweat_smile:
    Kevin Menhinick
    @kevbot-git
    If anyone does get a sec to checkout my small PR, would anyone recommend a way to test what I've changed? I'm struggling to figure out the tests dherault/serverless-offline#1064
    Kamil Dybicz
    @kdybicz
    Hey all! Quick question about an issue raised in dherault/serverless-offline#832 It looks like changes merged as a fix there were at some point reverted https://github.com/dherault/serverless-offline/blob/master/src/ServerlessOffline.js#L269 and it's no longer enough to set private: true on http events to make serverless-offline to generate an print out the x-api-key anymore. Was that done on purpose and I'm just missing something or it's a regression that I can help to patch up?
    Kamil Dybicz
    @kdybicz
    kwongkz
    @kwongkz
    Wanna ask is it serverless-offline after v6 no longer send X-Forwarded-Proto in Lambda-Proxy event request headers?
    David Hérault
    @dherault
    @kwongkz if so please open an issue :)
    @kdybicz merged thanks!
    Kamil Dybicz
    @kdybicz
    :+1:
    Matthew Kelch
    @kelchm
    Has anyone dug into #1080, #1081, #1083? These all seem to be related to changes in #1050
    Matthew Kelch
    @kelchm
    FYI, shared some of the results of my testing with v6.7.0 here: https://github.com/dherault/serverless-offline/issues/931#issuecomment-687234909
    Matthew Kelch
    @kelchm
    I've created a PR to try to address the above: dherault/serverless-offline#1090
    David Hérault
    @dherault
    Thanks @kelchm
    Dustin Goodman
    @dustinsgoodman
    image.png
    Hey @dherault, I upgraded to version 6.7.0 earlier today and am seeing the above anytime I run a function against my lambda. It's specific to version 6.7.0 as 6.6.0 is working fine. Trying to figure out more info for you still but wanted to toss this in here in case it's a known issue.
    Dustin Goodman
    @dustinsgoodman
    Looks like invocationRoute.js changed to return an async function but didn't properly fix the key-value mapping on the return object and might not be handling the await downstream. See https://github.com/dherault/serverless-offline/compare/v6.7.0...master#diff-c23f5dac27510ddbb5b7b60780e7571dR12
    Going to open a Github issue with the above for you to get to later.
    Dustin Goodman
    @dustinsgoodman
    David Hérault
    @dherault
    Guys I'm so sorry I did not see that comming. On it
    Dustin Goodman
    @dustinsgoodman
    No worries! Thank you :)
    David Hérault
    @dherault
    Does it crash the same way using v6.8.0?
    Dustin Goodman
    @dustinsgoodman
    Pulling it down now to test.
    All better in v6.8.0! :D
    Closed the above issue with the notes regarding resolution. Thanks for the fix!
    tan-t
    @tan-t

    hi!
    I'm using serverless-offline 6.5.0 in my project, and want to test my functions which don't have an HTTP events with invocation endpoint (via aws-cli).
    I remember when it was 5.10.0, the serverless-offline plugin just gave me invocation endpoint for all the functions like below:

    ...
    Serverless: Routes for helloworld:
    Serverless: POST /{apiVersion}/functions/myservice-dev-helloworld/invocations
    ...

    but with 6.5.0, it seems that the plugin isn't giving invocation endpoints unless the function has an HTTP event.
    I don't find any breaking changes or migration guides related to this in v6,
    but when I downgraded my serverless-offline to 5.10.0, it started to create endpoints, so I think it is a version problem.

    does anyone know how to make it create invocation endpoint for all the functions with serverless-offline v6?

    tan-t
    @tan-t
    sorry I've mistakenly thought that the plugin is not making endpoints but it turns out that it is making them silently. with SLS_DEBUG=* , I can see invocation endpoints and they are working nicely actually.
    David Hérault
    @dherault
    :thumbsup:
    Ross Coundon
    @rcoundon

    I have a serverless.yml with a collection of lambdas. There are currently some API Gateway triggered lambdas and one that is SQS triggered.
    The environment is set at the provider level.

    I'm running this using serverless-offline and for SQS I'm using the serverless-offline-sqs-esmq plugin.

    The peculiar thing is, for the API Gateway triggered lambdas, all the process.env values are set correctly. However, when the SQS triggered lambda runs, none of the environment variables set in serverless.yml are available. Serverless is setting something as I can see that the IS_OFFLINE property is set, just none of my own specified ones.

    There is no difference in config other than the event source for the two different types. I've also tried specifying the environment at the function level but this makes no difference.

    Has anyone seen this or know what it could be?

    Thanks

    Gurkiran Singh
    @Gurkiran-Singh

    Hi,
    I am new to Serverless.
    I just want to know if there is any way around that we can create s3 buckets using serverless if else plugin.

    What I am trying to achieve is that I want to create new s3 buckets as per Stage I gave in if else statement.

    Fr example if script(serverless.yml) runs in production stage it should create different s3 bucket and if script runs in development stage then it should create different bucket according to if else statement.

    Please let me know if there is any way around to achieve this.

    Vishesh M
    @visheshCuriousDev
    Hi guys !! Is there no hot reload for serverless offline ?
    I run "SLS_DEBUG=* sls offline start". It run in debug mode but any changes made to any of the handler files, it does not reload !!! Any idea ?
    Jack Fazackerley
    @JackFazackerley

    Hi I'm running serverless-offline v6.8.0, serverless v2.16.1, Go v1.15.5 and for some reason i can only GET, any time i POST it's as if serverless-offline is blocking me? The connection just hangs and there are no lo gs. The command i'm running is: `SLS_DEBUG=* sls --verbose offline start --useDocker. My serverless file looks like:

    service: example
    
    frameworkVersion: '2'
    
    plugins:
      - serverless-offline
    
    provider:
      name: aws
      runtime: go1.x
      stage: ${self:custom.stage}
      region: ${self:custom.region}
    
    custom:
      stage: ${opt:stage, 'develop'}
      region: ${file(env.yml):regions.${self:custom.stage}}
    
    package:
      individually: true
      exclude:
        - ./**
    
    functions:
      api:
        runtime: go1.x
        handler: bin/api
        events:
          - http:
              cors:
                origin: '*'
              path: api
              method: any
        package:
          include:
            - bin/api
        environment: ${file(env.yml):environment.example}.

    I'm unsure if i'm doing anything wrong or it's the versions?