Skip to content

Commit

Permalink
Extract aws-user-function to separate module to resolve import issues
Browse files Browse the repository at this point in the history
  • Loading branch information
RafalSumislawski committed Jun 6, 2024
1 parent 1c74b04 commit 59c82b1
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 5 deletions.
9 changes: 8 additions & 1 deletion ci-scripts/build_nodejs_layer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,20 @@ rm -f import-in-the-middle-*.tgz
npm install && npm pack
popd > /dev/null

pushd ./nodejs/packages/cx-aws-user-function
rm -f cx-aws-user-function-*.tgz
npm install && npm pack
popd > /dev/null

pushd ./nodejs/packages/cx-wrapper
npm install \
${OPENTELEMETRY_JS_CONTRIB_PATH}/plugins/node/opentelemetry-instrumentation-aws-lambda/opentelemetry-instrumentation-aws-lambda-*.tgz \
${OPENTELEMETRY_JS_CONTRIB_PATH}/plugins/node/opentelemetry-instrumentation-mongodb/opentelemetry-instrumentation-mongodb-*.tgz \
${OPENTELEMETRY_JS_CONTRIB_PATH}/plugins/node/opentelemetry-instrumentation-aws-sdk/opentelemetry-instrumentation-aws-sdk-*.tgz \
${OPENTELEMETRY_JS_PATH}/experimental/packages/opentelemetry-instrumentation/opentelemetry-instrumentation-*.tgz \
${OPENTELEMETRY_JS_PATH}/packages/opentelemetry-sdk-trace-base/opentelemetry-sdk-trace-base-*.tgz \
${IITM_PATH}/import-in-the-middle-*.tgz
${IITM_PATH}/import-in-the-middle-*.tgz \
${CWD}/nodejs/packages/cx-aws-user-function/cx-aws-user-function-*.tgz
popd > /dev/null

# Build import-in-the-middle
Expand All @@ -117,6 +123,7 @@ npm install \
${OPENTELEMETRY_JS_PATH}/experimental/packages/opentelemetry-instrumentation/opentelemetry-instrumentation-*.tgz \
${OPENTELEMETRY_JS_PATH}/packages/opentelemetry-sdk-trace-base/opentelemetry-sdk-trace-base-*.tgz \
${IITM_PATH}/import-in-the-middle-*.tgz \
${CWD}/nodejs/packages/cx-aws-user-function/cx-aws-user-function-*.tgz \
${CWD}/nodejs/packages/cx-wrapper/cx-wrapper-*.tgz
popd > /dev/null

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const {
MalformedHandlerName,
ImportModuleError,
UserCodeSyntaxError
} = require("./Errors.cjs");
} = require("./Errors.js");
const path = require("path");
const fs = require("fs");
const FUNCTION_EXPR = /^([^.]*)\.(.*)$/;
Expand Down
15 changes: 15 additions & 0 deletions nodejs/packages/cx-aws-user-function/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions nodejs/packages/cx-aws-user-function/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "cx-aws-user-function",
"version": "0.0.1",
"private": true,
"description": "",
"repository": "",
"keywords": [
"opentelemetry",
"awslambda",
"nodejs",
"tracing",
"profiling",
"instrumentation"
],
"engines": {
"node": ">=16.0.0"
},
"files": [
"*.js",
"*.d.ts"
]
}
2 changes: 1 addition & 1 deletion nodejs/packages/cx-wrapper/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { load } from './aws/aws-user-function.js';
import { load } from 'cx-aws-user-function';
import {
Callback,
Context,
Expand Down
13 changes: 13 additions & 0 deletions nodejs/packages/cx-wrapper/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion nodejs/packages/cx-wrapper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"node": ">=16.0.0"
},
"files": [
"aws/*",
"*.js",
"*.d.ts",
"*.map",
Expand Down Expand Up @@ -56,6 +55,7 @@
"@opentelemetry/sdk-metrics": "1.22.0",
"@opentelemetry/sdk-trace-base": "file:../../../../../oss/opentelemetry-js/packages/opentelemetry-sdk-trace-base/opentelemetry-sdk-trace-base-1.22.0.tgz",
"@opentelemetry/sdk-trace-node": "1.22.0",
"cx-aws-user-function": "file:../cx-aws-user-function/cx-aws-user-function-0.0.1.tgz",
"import-in-the-middle": "file:../../../../import-in-the-middle/import-in-the-middle-1.7.3.tgz"
},
"overrides": {
Expand Down
12 changes: 11 additions & 1 deletion nodejs/packages/layer/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions nodejs/packages/layer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"@opentelemetry/sdk-metrics": "1.22.0",
"@opentelemetry/sdk-trace-base": "file:../../../../../oss/opentelemetry-js/packages/opentelemetry-sdk-trace-base/opentelemetry-sdk-trace-base-1.22.0.tgz",
"@opentelemetry/sdk-trace-node": "1.22.0",
"cx-aws-user-function": "file:../cx-aws-user-function/cx-aws-user-function-0.0.1.tgz",
"cx-wrapper": "file:../cx-wrapper/cx-wrapper-0.0.1.tgz",
"import-in-the-middle": "file:../../../../import-in-the-middle/import-in-the-middle-1.7.3.tgz"
},
Expand Down

0 comments on commit 59c82b1

Please sign in to comment.