Jürgen Leschner
Jürgen Leschner
CDCloudflare Developers
Created by Quollveth Usernames on 10/26/2024 in #workers-help
email worker example not working
The message body is available in message.raw which you have to parse in your code using a library like postal-mime
import PostalMime from 'postal-mime';

export default {
async email(message, env, ctx) {
const email = await PostalMime.parse(message.raw);

console.log('Subject: ', email.subject);
console.log('HTML: ', email.html);
console.log('Text: ', email.text);
}
};
import PostalMime from 'postal-mime';

export default {
async email(message, env, ctx) {
const email = await PostalMime.parse(message.raw);

console.log('Subject: ', email.subject);
console.log('HTML: ', email.html);
console.log('Text: ', email.text);
}
};
13 replies
CDCloudflare Developers
Created by Quollveth Usernames on 10/26/2024 in #workers-help
email worker example not working
yeah, posting the form cross-origin from a browser requires cors headers. https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS hono has built-in cors middleware if you're looking for something lightweight to run in the worker. Another workaround would be to proxy those requests through a worker on the form website's domain so that they are no longer cross-origin.
13 replies
CDCloudflare Developers
Created by Quollveth Usernames on 10/26/2024 in #workers-help
email worker example not working
Writeup added here (see #4), and code here.
13 replies
CDCloudflare Developers
Created by Quollveth Usernames on 10/26/2024 in #workers-help
email worker example not working
I tested the behavior myself, and found that in addition to the binding, the to and from addresses must match custom and destination addresses configured in the email routing setup for your domain.
13 replies
CDCloudflare Developers
Created by Quollveth Usernames on 10/26/2024 in #workers-help
email worker example not working
Hi @Quollveth Usernames, can you confirm that you have a binding in your wrangler.toml with a name that matches your code (SEB if you followed the docs exactly)
13 replies
CDCloudflare Developers
Created by Bruno Miranda on 10/22/2024 in #workers-help
Workers with route configured are not being triggered
Yeah, based on what you wrote with *domain.com/* I thought you needed all requests for all paths and subdomains to be proxied to the new origin. I would recommend getting redirects to work because that will take the request load off the old origin (but it assumes that the clients can do redirects)
8 replies
CDCloudflare Developers
Created by DangerZone on 10/14/2024 in #workers-help
Accessing Remote R2 while having local assets
cc @tanushree │ Workers PM (this is the R2 --remote use case I mentioned)
7 replies
CDCloudflare Developers
Created by Bruno Miranda on 10/22/2024 in #workers-help
Workers with route configured are not being triggered
the route that targets the worker (I thought you were using a wildcard so all request would be affected)
8 replies
CDCloudflare Developers
Created by Jürgen Leschner on 10/24/2024 in #workflows-beta
Guide | Cloudflare Workflows docs
Live already 👍
6 replies
CDCloudflare Developers
Created by Jürgen Leschner on 10/24/2024 in #workflows-beta
Guide | Cloudflare Workflows docs
No description
6 replies
CDCloudflare Developers
Created by Bruno Miranda on 10/22/2024 in #workers-help
Workers with route configured are not being triggered
b.t.w. you might consider using a redirect rule or Origin rules instead of a worker which will be invoked on every request.
8 replies
CDCloudflare Developers
Created by Bruno Miranda on 10/22/2024 in #workers-help
Workers with route configured are not being triggered
@Bruno Miranda I don't know if this is the root cause of your issue, but from your code above it looks like you have implemented both the old service worker api and the new ESM api for your worker. I would start with removing the eventlistener at the top. https://developers.cloudflare.com/workers/reference/migrate-to-module-workers/
8 replies
CDCloudflare Developers
Created by bateswebtech on 10/22/2024 in #workers-help
Worker CLI deployment error
4 replies