splunk / splunk-javascript-logging

Splunk HTTP Event Collector logging interface for JavaScript
http://dev.splunk.com/view/splunk-logging-javascript/SP-CAAAE63
Apache License 2.0
85 stars 47 forks source link

Getting errors from library when using on the Front end App #78

Closed nithincs20 closed 1 year ago

nithincs20 commented 1 year ago

Hello,

I am trying to use the library to log data to Splunk from an ReactJS app on the front end. But when I try with basic example I am getting the errors given below.

Module not found: Error: Can't resolve 'crypto' in '#####/node_modules/needle/lib'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
    - install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "crypto": false }
WARNING in ./node_modules/needle/lib/needle.js 44:13-28
Module not found: Error: Can't resolve 'zlib' in '#####/node_modules/needle/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "zlib": require.resolve("browserify-zlib") }'
    - install 'browserify-zlib'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "zlib": false }

WARNING in ./node_modules/sax/lib/sax.js 162:13-37
Module not found: Error: Can't resolve 'stream' in '#####/node_modules/sax/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
    - install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "stream": false }
...

Could you help us to resolve this issue? Please suggest if there is any other way to integrate Splunk on the FE apps if it is not resolvable.

Information : ReactJS - react: "^17.0.2", react-scripts : "5.0.1" Version of this project you're using - 0.11.1 Platform version - MacOS Framework version - Node.js v14.17.0

kurmivivek295 commented 1 year ago

Did you find any solution?

nithincs20 commented 1 year ago

Did you find any solution?

@kurmivivek295 No, It is not meant to be used in Frontend I guess, looking for other options. Closing the issue.

kurmivivek295 commented 1 year ago

I have used Splunk RUM solution. Thanks

nithincs20 commented 1 year ago

Thanks @kurmivivek295 for sharing that info.