Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LogTape doesn't work on Cloudflare Workers #5

Closed
kitsonk opened this issue Jul 2, 2024 · 2 comments
Closed

LogTape doesn't work on Cloudflare Workers #5

kitsonk opened this issue Jul 2, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@kitsonk
Copy link
Contributor

kitsonk commented Jul 2, 2024

There appear to be two issues that prevent logtape from working on Cloudflare Workers:

  • Cloudflare Workers fails on the import of node:fs as it isn't supported, even under node compat mode. I suspect this can be worked around by expanding the filesink.web.ts to be a full implementation and determine and then dynamically load that.
  • The LoggerImpl uses WeakRef, which Cloudflare Workers don't support. They claim there are some limitations/challenges to this, though the details are very vague. In logtape, this appears to be isolated to managing "child" loggers so that that they can be enumerated but not hold a strong reference so any children can be GC'ed. I don't know of an easy workaround to this.
@dahlia
Copy link
Owner

dahlia commented Jul 2, 2024

Given the short lifetime of edge functions like Cloudflare Workers, it might not be necessary to use WeakRefs in that environment. I'm not sure though. 🤔

@dahlia dahlia self-assigned this Jul 15, 2024
@dahlia dahlia added the bug Something isn't working label Jul 15, 2024
@dahlia dahlia changed the title logtape doesn't work on Cloudflare Workers LogTape doesn't work on Cloudflare Workers Jul 15, 2024
@dahlia
Copy link
Owner

dahlia commented Jul 15, 2024

I've just released LogTape 0.4.2, which must work on Cloudflare Workers.

@kitsonk Check it out!

@dahlia dahlia closed this as completed Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants