Skip to content

Commit

Permalink
support esm in lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
raphael-theriault-swi committed Feb 29, 2024
1 parent 3d4e8d4 commit ec83dc0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion lambda/shim.cjs

This file was deleted.

7 changes: 6 additions & 1 deletion lambda/wrapper
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/bin/bash

export NODE_OPTIONS="${NODE_OPTIONS} --require /opt/solarwinds-apm/shim.cjs"
if [ -z "${SW_APM_ESM}" ]; then
export NODE_OPTIONS="${NODE_OPTIONS} --require {{name}}"
else
export NODE_OPTIONS="${NODE_OPTIONS} --import {{name}}"
fi

export OTEL_EXPORTER_OTLP_PROTOCOL="grpc"

# Lambda function is default service name
Expand Down
2 changes: 1 addition & 1 deletion scripts/lambda.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ rm("lambda/layer.zip")
rm("node_modules/.lambda", { recursive: true })
cpSync("lambda", "node_modules/.lambda", { recursive: true })
replace("node_modules/.lambda/package.json")
replace("node_modules/.lambda/shim.cjs")
replace("node_modules/.lambda/wrapper")

execSync("touch yarn.lock && yarn install", {
cwd: "node_modules/.lambda",
Expand Down

0 comments on commit ec83dc0

Please sign in to comment.