serverless-offline 13.10.0 → 13.10.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/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import { Buffer } from "node:buffer"
|
|
|
2
2
|
import { readFile } from "node:fs/promises"
|
|
3
3
|
import { createRequire } from "node:module"
|
|
4
4
|
import { join, resolve } from "node:path"
|
|
5
|
-
import { exit } from "node:process"
|
|
5
|
+
import { exit, env } from "node:process"
|
|
6
6
|
import h2o2 from "@hapi/h2o2"
|
|
7
7
|
import { Server } from "@hapi/hapi"
|
|
8
8
|
import { log } from "../../utils/log.js"
|
|
@@ -613,7 +613,27 @@ export default class HttpServer {
|
|
|
613
613
|
const hasCustomAuthProvider =
|
|
614
614
|
customizations?.offline?.customAuthenticationProvider
|
|
615
615
|
|
|
616
|
-
|
|
616
|
+
const authorizerOverrideHeader =
|
|
617
|
+
request.headers["sls-offline-authorizer-override"]
|
|
618
|
+
const authorizerOverrideEnv = env.AUTHORIZER
|
|
619
|
+
const hasAuthorizerOverride = [
|
|
620
|
+
authorizerOverrideHeader,
|
|
621
|
+
authorizerOverrideEnv,
|
|
622
|
+
].some((value) => {
|
|
623
|
+
if (!value) return false
|
|
624
|
+
try {
|
|
625
|
+
parse(value)
|
|
626
|
+
return true
|
|
627
|
+
} catch {
|
|
628
|
+
return false
|
|
629
|
+
}
|
|
630
|
+
})
|
|
631
|
+
|
|
632
|
+
if (
|
|
633
|
+
!endpoint.authorizer &&
|
|
634
|
+
!hasCustomAuthProvider &&
|
|
635
|
+
!hasAuthorizerOverride
|
|
636
|
+
) {
|
|
617
637
|
log.debug("no authorizer configured, deleting authorizer payload")
|
|
618
638
|
delete event.requestContext.authorizer
|
|
619
639
|
}
|
|
@@ -52,16 +52,14 @@ export default class HandlerRunner {
|
|
|
52
52
|
|
|
53
53
|
if (supportedNodejs.has(runtime)) {
|
|
54
54
|
if (useInProcess) {
|
|
55
|
-
const { default: InProcessRunner } =
|
|
56
|
-
"./in-process-runner/index.js"
|
|
57
|
-
)
|
|
55
|
+
const { default: InProcessRunner } =
|
|
56
|
+
await import("./in-process-runner/index.js")
|
|
58
57
|
|
|
59
58
|
return new InProcessRunner(this.#funOptions, this.#env)
|
|
60
59
|
}
|
|
61
60
|
|
|
62
|
-
const { default: WorkerThreadRunner } =
|
|
63
|
-
"./worker-thread-runner/index.js"
|
|
64
|
-
)
|
|
61
|
+
const { default: WorkerThreadRunner } =
|
|
62
|
+
await import("./worker-thread-runner/index.js")
|
|
65
63
|
|
|
66
64
|
return new WorkerThreadRunner(this.#funOptions, this.#env)
|
|
67
65
|
}
|