logdna / logger-node

A nodejs logger client for LogDNA
MIT License
34 stars 17 forks source link

Client side logging failed with webpack error #41

Closed MrNghia123 closed 2 years ago

MrNghia123 commented 3 years ago

Webpack run successfully as part of Next dev command. However on browser it gives the following error at the import {createLogger} from '@logdna/logger'

This is the error stack ` Unhandled Runtime Error

Error: Cannot find module 'net' Call Stack

webpackMissingModule@webpack-internal:///./node_modules/@logdna/logger/lib/logger.js (6:80) webpack-internal:///./node_modules/@logdna/logger/lib/logger.js (6:158) webpack-internal:///./node_modules/@logdna/logger/lib/logger.js (857:30) ./node_modules/@logdna/logger/lib/logger.js file:/usr/app/.next/static/chunks/pages/settings/groups.js (586:1) __webpack_require__ /_next/static/chunks/webpack.js (873:31) fn file:/usr/app/.next/static/chunks/webpack.js (151:20) node_modules/@logdna/logger/index.js (3:23) ./node_modules/@logdna/logger/index.js ...`
wzulfikar commented 3 years ago

I got the same error too, except that it asks for net and tls package. I installed net and tls using yarn add tls net and then it works, but i'm sure if this is the correct approach.

TerryMooreII commented 3 years ago

@wzulfikar @MrNghia123 We are currently working on a browser specific version of our JavaScript logger. The release date is still being determined but if you would like to learn more or chat with us about your specific use case then feel free to contact Michael Shi (michael.shi (at) logdna.com)

TerryMooreII commented 3 years ago

@wzulfikar @MrNghia123 I wanted to let you know that we have officially release our front end JavaScript logger for public beta. I would love you to try it out and let us know what you think. Thank you https://www.npmjs.com/package/@logdna/browser https://github.com/logdna/logdna-browser

lmcarreiro commented 2 years ago

Thanks @TerryMooreII , it works with the browser package now!

I lost some time until I was able to reach this github issue page... I think it would help others if you update the docs on https://docs.logdna.com/docs/client-side-logging, it still shows example using the deprecated https://www.npmjs.com/package/logdna package.

Also need to update the docs about client side logging on the main node.js package https://www.npmjs.com/package/@logdna/logger#client-side that says it works, but shows an example that doesn't work when running from browser.

darinspivey commented 2 years ago

Also need to update the docs about client side logging on the main node.js package

Thanks @lmcarreiro! Obviously, this is important to get cleaned up, so thank you for reporting the doc issues. We'll get the website docs updated, and I'll open a PR to fix the logger repo. Thanks!

logdnabot commented 2 years ago

:tada: This issue has been resolved in version 2.6.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: