lumigo-io / lumigo-node

Lumigo's Node.js Distributed Tracing and Performance Agent
https://lumigo.io
Apache License 2.0
76 stars 12 forks source link

Require Function Warning During Webpack Build #451

Open Drakmyth opened 1 year ago

Drakmyth commented 1 year ago

Describe the bug We are integrating our node-based AWS Lambda functions with Lumigo and noticed the following warnings in our pipeline logs. Our functions are written in TypeScript and we are able to reproduce the warnings locally running a simple webpack build. I don't believe we are seeing any adverse behavior due to these warnings, but wanted to surface them so they could be addressed just in case. Our code is for an internal closed-source application, so I'm likely unable to provide specific code or configuration examples, but I am happy to consider any further questions and facilitate any troubleshooting as necessary.

Expected behavior No warnings during a build.

Runtime details Node: 19.9.0 Webpack: 5.75.0 Lumigo-node: 1.84.2 Typescript: 4.9.4

Logs

WARNING in ./node_modules/@lumigo/tracer/dist/utils/requireUtils.js 18:83-90
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
    at CommonJsRequireContextDependency.getWarnings (/opt/atlassian/pipelines/agent/build/node_modules/webpack/lib/dependencies/ContextDependency.js:102:18)
    at Compilation.reportDependencyErrorsAndWarnings (/opt/atlassian/pipelines/agent/build/node_modules/webpack/lib/Compilation.js:3132:24)
    at /opt/atlassian/pipelines/agent/build/node_modules/webpack/lib/Compilation.js:2729:28
    at _next2 (eval at create (/opt/atlassian/pipelines/agent/build/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:34:1)
    at eval (eval at create (/opt/atlassian/pipelines/agent/build/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:62:1)
    at /opt/atlassian/pipelines/agent/build/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:385:11
    at /opt/atlassian/pipelines/agent/build/node_modules/neo-async/async.js:2830:7
    at Object.each (/opt/atlassian/pipelines/agent/build/node_modules/neo-async/async.js:2850:39)
    at /opt/atlassian/pipelines/agent/build/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:361:18
    at /opt/atlassian/pipelines/agent/build/node_modules/neo-async/async.js:2830:7
 @ ./node_modules/@lumigo/tracer/dist/hooks/mongodb.js 5:21-53
 @ ./node_modules/@lumigo/tracer/dist/hooks/index.js 5:16-36
 @ ./node_modules/@lumigo/tracer/dist/index.js 18:14-32

WARNING in ./node_modules/@lumigo/tracer/dist/utils/requireUtils.js 25:87-94
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
    at CommonJsRequireContextDependency.getWarnings (/opt/atlassian/pipelines/agent/build/node_modules/webpack/lib/dependencies/ContextDependency.js:102:18)
    at Compilation.reportDependencyErrorsAndWarnings (/opt/atlassian/pipelines/agent/build/node_modules/webpack/lib/Compilation.js:3132:24)
    at /opt/atlassian/pipelines/agent/build/node_modules/webpack/lib/Compilation.js:2729:28
    at _next2 (eval at create (/opt/atlassian/pipelines/agent/build/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:34:1)
    at eval (eval at create (/opt/atlassian/pipelines/agent/build/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:62:1)
    at /opt/atlassian/pipelines/agent/build/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:385:11
    at /opt/atlassian/pipelines/agent/build/node_modules/neo-async/async.js:2830:7
    at Object.each (/opt/atlassian/pipelines/agent/build/node_modules/neo-async/async.js:2850:39)
    at /opt/atlassian/pipelines/agent/build/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:361:18
    at /opt/atlassian/pipelines/agent/build/node_modules/neo-async/async.js:2830:7
 @ ./node_modules/@lumigo/tracer/dist/hooks/mongodb.js 5:21-53
 @ ./node_modules/@lumigo/tracer/dist/hooks/index.js 5:16-36
 @ ./node_modules/@lumigo/tracer/dist/index.js 18:14-32

Additional context We do have esModuleInterop: true in our tsconfig.json and tsc does not surface any warnings or errors. The above errors only surface when running webpack.