microsoft / ApplicationInsights-node.js

Microsoft Application Insights SDK for Node.js
MIT License
320 stars 138 forks source link

[BUG] Module not found: Error: Can't resolve 'fs' in 'C:\digital-b2c-channel-web-app\node_modules\applicationinsights\out\Library' #1204

Open kiran8983 opened 10 months ago

kiran8983 commented 10 months ago

Description/Screenshot

Module not found: Error: Can't resolve 'fs' in 'C:\digital-b2c-channel-web-app\node_modules\applicationinsights\out\Library'

* Steps to Reproduce

  1. Clone the project or navigate to the project directory.

  2. Run the yarn storybook build command. which internally runs following: yarn add loader-utils --cmd-install && cross-env NODE_OPTIONS=--openssl-legacy-provider build-storybook -s ./public -o ./storybook-output

  3. Observe the error mentioned above.

    • SDK Version: Next.js 13.3.1
    • How you initialized the SDK: I ran the yarn storybook build command.

Expected behavior I expected the yarn storybook build command to run successfully without any errors.

Actual behavior I encountered the error message mentioned above, and the build process failed.

Additional context This error seems to be related to the fs module in the applicationinsights package. It appears to be blocking the build process.

MSNev commented 10 months ago

This looks like the node SDK and not this SDK (browser focused)???

Transfering to the node github

MSNev commented 10 months ago

@JacksonWeber / @hectorhdzg ??

hectorhdzg commented 10 months ago

@kiran8983 this is usually the kind of error when you try to run Node.js SDK in the browser or some where Node.js native libraries are not available, not super familiar with next.js but maybe this is related to way you are building your app?

JacksonWeber commented 2 months ago

@kiran8983 Were you able to determine if you were running the Node.js SDK in a non-server part of your Next.js code?