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

Errors in Cloudflare Workers environment with recent versions #64

Open
primeare opened this issue Feb 14, 2024 · 3 comments
Open

Errors in Cloudflare Workers environment with recent versions #64

primeare opened this issue Feb 14, 2024 · 3 comments

Comments

@primeare
Copy link

Introduction

Cloudflare in their documentation propose to use mimetext for sending emails in their Cloudflare Workers and Cloudflare Email Workers.

The problem

Since updating to version 3.0.21 (although it could be any version after 3.0.16, as it worked previously), the library does not work natively in the Cloudflare Workers environment. By saying natively, I mean without transpiling code or enabling Node.js compatibility modes or flags.

Hotfix solution

Currently, I found two possible solutions:

  1. Use browser version of mimetext: import { createMimeMessage } from 'mimetext/browser';;
  2. Enable node_compat = true in wrangler.toml to turn on Node.js polyfills.

Error details in cloudflare/wrangler-action

Node.js version: 18.19.0
NPM version: 10.2.3

image
@muratgozel
Copy link
Owner

hey @primeare they look like good solutions, and i think they should be in the readme under use section. create a pr if you wish or i will soon update the readme and include this.

@muratgozel
Copy link
Owner

ps: i will test the the library in cloudflare worker environment later and come up with a proper solution

@sannajammeh
Copy link

I just use mimetext/browser for this. Worker-d runs on web standards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants