Anything related to the Serverless-Offline plugin for the Serverless framework.
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.
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
Contributing
section of the README
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?
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?
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
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.
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?
node[91757]: ../src/env-inl.h:1036:void node::Environment::AddCleanupHook(void (*)(void *), void *): Assertion `(insertion_info.second) == (true)' failed.
1: 0x10009ce91 node::Abort() [/usr/local/bin/node]
2: 0x10009cd1a node::AppendExceptionLine(node::Environment*, v8::Local<v8::Value>, v8::Local<v8::Message>, node::ErrorHandlingMode) [/usr/local/bin/node]
3: 0x10001f6be node::Environment::AddCleanupHook(void (*)(void*), void*) [/usr/local/bin/node]
4: 0x100008b00 node::AddEnvironmentCleanupHook(v8::Isolate*, void (*)(void*), void*) [/usr/local/bin/node]
5: 0x107903206 WrappedRE2::Init() [/Users/Test/Documents/instagram-bot/serverless/node_modules/re2/build/Release/re2.node]
6: 0x107903f23 node_register_module_v88 [/Users/Test/Documents/instagram-bot/serverless/node_modules/re2/build/Release/re2.node]
7: 0x10007bf86 std::__1::__function::__func<node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&)::$_0, std::__1::allocator<node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>, bool (node::binding::DLib*)>::operator()(node::binding::DLib*&&) [/usr/local/bin/node]
8: 0x10007ada9 node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
9: 0x10021da46 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/usr/local/bin/node]
10: 0x10021d0c9 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node]
11: 0x10021c8b0 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/bin/node]
12: 0x1007fd979 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/usr/local/bin/node]
Abort trap: 6