serverless-offline 13.5.0 → 13.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/package.json +2 -2
- package/src/ServerlessOffline.js +3 -2
- package/src/events/alb/HttpServer.js +1 -1
- package/src/events/authFunctionNameExtractor.js +1 -1
- package/src/events/authValidateContext.js +1 -1
- package/src/events/http/Endpoint.js +1 -1
- package/src/events/http/HttpServer.js +10 -1
- package/src/events/http/authJWTSettingsExtractor.js +1 -1
- package/src/events/http/createAuthScheme.js +1 -1
- package/src/events/http/createJWTAuthScheme.js +1 -1
- package/src/events/http/lambda-events/LambdaIntegrationEvent.js +1 -1
- package/src/events/http/lambda-events/LambdaProxyIntegrationEvent.js +1 -1
- package/src/events/http/lambda-events/LambdaProxyIntegrationEventV2.js +1 -1
- package/src/events/http/lambda-events/renderVelocityTemplateObject.js +1 -1
- package/src/events/schedule/Schedule.js +1 -1
- package/src/events/websocket/HttpServer.js +1 -1
- package/src/events/websocket/WebSocketClients.js +1 -1
- package/src/events/websocket/WebSocketServer.js +1 -1
- package/src/events/websocket/http-routes/_catchAll/catchAllRoute.js +1 -1
- package/src/events/websocket/http-routes/connections/connectionsRoutes.js +1 -1
- package/src/lambda/HttpServer.js +1 -1
- package/src/lambda/LambdaFunction.js +1 -1
- package/src/lambda/handler-runner/HandlerRunner.js +1 -1
- package/src/lambda/handler-runner/docker-runner/DockerContainer.js +1 -1
- package/src/lambda/handler-runner/docker-runner/DockerImage.js +1 -1
- package/src/lambda/handler-runner/go-runner/GoRunner.js +2 -2
- package/src/lambda/handler-runner/java-runner/JavaRunner.js +1 -1
- package/src/lambda/handler-runner/python-runner/PythonRunner.js +1 -1
- package/src/lambda/handler-runner/ruby-runner/RubyRunner.js +1 -1
- package/src/lambda/routes/invocations/InvocationsController.js +1 -1
- package/src/utils/getHttpApiCorsConfig.js +1 -1
- package/src/utils/log.js +20 -0
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Serverless Offline
|
|
2
2
|
|
|
3
|
+
⚠️
|
|
4
|
+
We are looking for maintainers! This package is entirely community-driven. Please send an email to dherault to start helping now.
|
|
5
|
+
⚠️
|
|
6
|
+
|
|
3
7
|
<p>
|
|
4
8
|
<a href="https://www.serverless.com">
|
|
5
9
|
<img src="http://public.serverless.com/badges/v3.svg">
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dedicatedTo": "Blue, a great migrating bird.",
|
|
3
3
|
"name": "serverless-offline",
|
|
4
|
-
"version": "13.5.
|
|
4
|
+
"version": "13.5.1",
|
|
5
5
|
"description": "Emulate AWS λ and API Gateway locally when developing your Serverless project",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"exports": {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"./lambda": "./src/lambda/index.js"
|
|
10
10
|
},
|
|
11
11
|
"type": "module",
|
|
12
|
+
"main": "src/index.js",
|
|
12
13
|
"scripts": {
|
|
13
14
|
"code-quality": "npm run prettier && npm run lint",
|
|
14
15
|
"lint": "eslint .",
|
|
@@ -80,7 +81,6 @@
|
|
|
80
81
|
"@hapi/boom": "^10.0.1",
|
|
81
82
|
"@hapi/h2o2": "^10.0.4",
|
|
82
83
|
"@hapi/hapi": "^21.3.3",
|
|
83
|
-
"@serverless/utils": "^6.15.0",
|
|
84
84
|
"array-unflat-js": "^0.1.3",
|
|
85
85
|
"boxen": "^7.1.1",
|
|
86
86
|
"chalk": "^5.3.0",
|
package/src/ServerlessOffline.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import process, { exit } from "node:process"
|
|
2
|
-
import { log } from "
|
|
2
|
+
import { log, setLogUtils } from "./utils/log.js"
|
|
3
3
|
import {
|
|
4
4
|
commandOptions,
|
|
5
5
|
CUSTOM_OPTION,
|
|
@@ -54,9 +54,10 @@ export default class ServerlessOffline {
|
|
|
54
54
|
"offline:start:ready": this.#ready.bind(this),
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
constructor(serverless, cliOptions) {
|
|
57
|
+
constructor(serverless, cliOptions, utils) {
|
|
58
58
|
this.#cliOptions = cliOptions
|
|
59
59
|
this.#serverless = serverless
|
|
60
|
+
setLogUtils(utils)
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
// Entry point for the plugin (sls offline) when running 'sls offline start'
|
|
@@ -5,7 +5,7 @@ import { join, resolve } from "node:path"
|
|
|
5
5
|
import { exit } from "node:process"
|
|
6
6
|
import h2o2 from "@hapi/h2o2"
|
|
7
7
|
import { Server } from "@hapi/hapi"
|
|
8
|
-
import { log } from "
|
|
8
|
+
import { log } from "../../utils/log.js"
|
|
9
9
|
import authFunctionNameExtractor from "../authFunctionNameExtractor.js"
|
|
10
10
|
import authJWTSettingsExtractor from "./authJWTSettingsExtractor.js"
|
|
11
11
|
import createAuthScheme from "./createAuthScheme.js"
|
|
@@ -592,6 +592,15 @@ export default class HttpServer {
|
|
|
592
592
|
)
|
|
593
593
|
|
|
594
594
|
event = lambdaProxyIntegrationEvent.create()
|
|
595
|
+
|
|
596
|
+
const customizations = this.#serverless.service.custom
|
|
597
|
+
const hasCustomAuthProvider =
|
|
598
|
+
customizations?.offline?.customAuthenticationProvider
|
|
599
|
+
|
|
600
|
+
if (!endpoint.authorizer && !hasCustomAuthProvider) {
|
|
601
|
+
log.debug("no authorizer configured, deleting authorizer payload")
|
|
602
|
+
delete event.requestContext.authorizer
|
|
603
|
+
}
|
|
595
604
|
}
|
|
596
605
|
|
|
597
606
|
log.debug("event:", event)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Buffer } from "node:buffer"
|
|
2
2
|
import crypto from "node:crypto"
|
|
3
3
|
import { env } from "node:process"
|
|
4
|
-
import { log } from "@serverless/utils/log.js"
|
|
5
4
|
import { decodeJwt } from "jose"
|
|
5
|
+
import { log } from "../../../utils/log.js"
|
|
6
6
|
import {
|
|
7
7
|
detectEncoding,
|
|
8
8
|
formatToClfTime,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// based on:
|
|
2
2
|
// https://github.com/ajmath/serverless-offline-scheduler
|
|
3
3
|
|
|
4
|
-
import { log } from "@serverless/utils/log.js"
|
|
5
4
|
import nodeSchedule from "node-schedule"
|
|
5
|
+
import { log } from "../../utils/log.js"
|
|
6
6
|
import ScheduleEvent from "./ScheduleEvent.js"
|
|
7
7
|
import ScheduleEventDefinition from "./ScheduleEventDefinition.js"
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ import { readFile } from "node:fs/promises"
|
|
|
2
2
|
import { resolve } from "node:path"
|
|
3
3
|
import { exit } from "node:process"
|
|
4
4
|
import { Server } from "@hapi/hapi"
|
|
5
|
-
import { log } from "
|
|
5
|
+
import { log } from "../../utils/log.js"
|
|
6
6
|
import { catchAllRoute, connectionsRoutes } from "./http-routes/index.js"
|
|
7
7
|
|
|
8
8
|
export default class HttpServer {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { log } from "@serverless/utils/log.js"
|
|
2
1
|
import ConnectionsController from "./ConnectionsController.js"
|
|
2
|
+
import { log } from "../../../../utils/log.js"
|
|
3
3
|
|
|
4
4
|
export default function connectionsRoutes(webSocketClients) {
|
|
5
5
|
const connectionsController = new ConnectionsController(webSocketClients)
|
package/src/lambda/HttpServer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { exit } from "node:process"
|
|
2
2
|
import { Server } from "@hapi/hapi"
|
|
3
|
-
import { log } from "
|
|
3
|
+
import { log } from "../utils/log.js"
|
|
4
4
|
import { invocationsRoute, invokeAsyncRoute } from "./routes/index.js"
|
|
5
5
|
|
|
6
6
|
export default class HttpServer {
|
|
@@ -4,9 +4,9 @@ import { dirname, join, resolve } from "node:path"
|
|
|
4
4
|
import process from "node:process"
|
|
5
5
|
import { performance } from "node:perf_hooks"
|
|
6
6
|
import { setTimeout } from "node:timers/promises"
|
|
7
|
-
import { log } from "@serverless/utils/log.js"
|
|
8
7
|
import { emptyDir, ensureDir, remove } from "fs-extra"
|
|
9
8
|
import jszip from "jszip"
|
|
9
|
+
import { log } from "../utils/log.js"
|
|
10
10
|
import HandlerRunner from "./handler-runner/index.js"
|
|
11
11
|
import LambdaContext from "./LambdaContext.js"
|
|
12
12
|
import {
|
|
@@ -4,11 +4,11 @@ import { readFile, unlink, writeFile } from "node:fs/promises"
|
|
|
4
4
|
import { platform } from "node:os"
|
|
5
5
|
import { dirname, join, sep } from "node:path"
|
|
6
6
|
import { LambdaClient, GetLayerVersionCommand } from "@aws-sdk/client-lambda"
|
|
7
|
-
import { log, progress } from "@serverless/utils/log.js"
|
|
8
7
|
import { execa } from "execa"
|
|
9
8
|
import { ensureDir, pathExists } from "fs-extra"
|
|
10
9
|
import isWsl from "is-wsl"
|
|
11
10
|
import jszip from "jszip"
|
|
11
|
+
import { log, progress } from "../../../utils/log.js"
|
|
12
12
|
import DockerImage from "./DockerImage.js"
|
|
13
13
|
import Runtime from "./DockerRuntime.js"
|
|
14
14
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { log } from "@serverless/utils/log.js"
|
|
2
1
|
import { execa } from "execa"
|
|
3
2
|
// TODO FIXME eslint plugin import bug, or not supporting package.json "expprts" field?
|
|
4
3
|
// eslint-disable-next-line import/no-unresolved
|
|
5
4
|
import promiseMemoize from "p-memoize"
|
|
5
|
+
import { log } from "../../../utils/log.js"
|
|
6
6
|
|
|
7
7
|
export default class DockerImage {
|
|
8
8
|
#imageNameTag = null
|
|
@@ -2,8 +2,8 @@ import { mkdir, readFile, rm, rmdir, writeFile } from "node:fs/promises"
|
|
|
2
2
|
import { EOL } from "node:os"
|
|
3
3
|
import process, { chdir, cwd } from "node:process"
|
|
4
4
|
import { parse as pathParse, resolve, sep } from "node:path"
|
|
5
|
-
import { log } from "@serverless/utils/log.js"
|
|
6
5
|
import { execa } from "execa"
|
|
6
|
+
import { log } from "../../../utils/log.js"
|
|
7
7
|
import { splitHandlerPathAndName } from "../../../utils/index.js"
|
|
8
8
|
|
|
9
9
|
const { parse, stringify } = JSON
|
|
@@ -89,7 +89,7 @@ export default class GoRunner {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
// Log to console in case engineers want to see the rest of the info
|
|
92
|
-
log(logs.join(EOL))
|
|
92
|
+
log.debug(logs.join(EOL))
|
|
93
93
|
|
|
94
94
|
return payload
|
|
95
95
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EOL } from "node:os"
|
|
2
2
|
import process from "node:process"
|
|
3
|
-
import { log } from "@serverless/utils/log.js"
|
|
4
3
|
import { invokeJavaLocal } from "java-invoke-local"
|
|
4
|
+
import { log } from "../../../utils/log.js"
|
|
5
5
|
|
|
6
6
|
const { parse, stringify } = JSON
|
|
7
7
|
const { hasOwn } = Object
|
|
@@ -3,8 +3,8 @@ import { EOL, platform } from "node:os"
|
|
|
3
3
|
import { delimiter, join as pathJoin, relative } from "node:path"
|
|
4
4
|
import process, { cwd, nextTick } from "node:process"
|
|
5
5
|
import { createInterface } from "node:readline"
|
|
6
|
-
import { log } from "@serverless/utils/log.js"
|
|
7
6
|
import { join } from "desm"
|
|
7
|
+
import { log } from "../../../utils/log.js"
|
|
8
8
|
import { splitHandlerPathAndName } from "../../../utils/index.js"
|
|
9
9
|
|
|
10
10
|
const { parse, stringify } = JSON
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { EOL, platform } from "node:os"
|
|
2
2
|
import { relative } from "node:path"
|
|
3
3
|
import { cwd } from "node:process"
|
|
4
|
-
import { log } from "@serverless/utils/log.js"
|
|
5
4
|
import { join } from "desm"
|
|
6
5
|
import { execa } from "execa"
|
|
6
|
+
import { log } from "../../../utils/log.js"
|
|
7
7
|
import { splitHandlerPathAndName } from "../../../utils/index.js"
|
|
8
8
|
|
|
9
9
|
const { parse, stringify } = JSON
|
package/src/utils/log.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
let utils
|
|
2
|
+
|
|
3
|
+
export function setLogUtils({ log, progress }) {
|
|
4
|
+
utils = { log, progress }
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const log = {
|
|
8
|
+
debug: (...args) => utils?.log?.debug(...args),
|
|
9
|
+
error: (...args) => utils?.log?.error(...args),
|
|
10
|
+
info: (...args) => utils?.log?.info(...args),
|
|
11
|
+
notice: (...args) => utils?.log?.notice(...args),
|
|
12
|
+
verbose: (...args) => utils?.log?.verbose(...args),
|
|
13
|
+
warning: (...args) => utils?.log?.warning(...args),
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const progress = {
|
|
17
|
+
get: (namespace) => utils?.progress?.get(namespace),
|
|
18
|
+
notice: (message) => utils?.progress?.notice(message),
|
|
19
|
+
remove: () => utils?.progress?.remove(),
|
|
20
|
+
}
|