Open seguri opened 2 years ago
In short, be sure to run npm install
before your publish line, and if you figure out more please feel free to post here and/or make a PR on the documentation. However, it looks like the issue is in the unix-dgram package, not in winston.
The Workers runtime uses the V8 engine and also implements many of the standard APIs available in most modern browsers. I'm not sure there's a way to make winston work. Do you see a way around dgram
in one of the provided APIs?
I'm saying it looks like the problem is in the unix-dgram package rather than in Winston.
I got that thanks, you wrote it twice. Do you know or have an idea how to make winston-syslog compatible with cloudworkers or not?
I donโt think you want to use the winston-syslog transport. If you are trying to send logs to some remote destination, you should use something like the built-in HTTP transport in Winston. The syslog transport is meant for writing things to Linux system logs, and I donโt think that Cloudflare workers give you access to such logs since they are not designed as full-fledged Linux VMs. Hope that helps steer you in the right direction.
Just an update: the Papertrail tutorial I've linked also mentions winston.transports.Http
; this throws fewer errors, but still fails, as there's a dependency on fs
:
$ wrangler publish
๐ ./node_modules/winston/dist/winston/tail-file.js
Module not found: Error: Can't resolve 'fs' in '/path/to/project/node_modules/winston/dist/winston'
There should be some polyfill for the fs module out there you can use. Or even better, see if you can trick Node into using the browser version of Winston (https://github.com/winstonjs/winston/blob/master/package.json#L59), which is designed to not rely on serverside modules like fs.
Hello,
I'd like to kindly ask you if you could add a section in the README about how to setup
winston-syslog
for remote logging in cloudflare workers. I'm following this tutorial but the build fails:I'm now looking into webpack and its
resolve.fallback
configuration, but I'm new to these things and it might take a while.Thanks