Skip to content

feat(cloudflare): add Send Email support to Worker - #1315

Closed
harshil1712 wants to merge 2 commits into
alchemy-run:mainfrom
harshil1712:main
Closed

feat(cloudflare): add Send Email support to Worker#1315
harshil1712 wants to merge 2 commits into
alchemy-run:mainfrom
harshil1712:main

Conversation

@harshil1712

Copy link
Copy Markdown

No description provided.

@john-royal john-royal self-assigned this Feb 5, 2026
@pkg-pr-new

pkg-pr-new Bot commented Feb 5, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/alchemy-run/alchemy@1315

commit: 9ad8f6b

@john-royal john-royal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a great start. Mind if I take it from here?

tail_consumers: props.tailConsumers?.map((consumer) =>
isWorker(consumer) ? { service: consumer.name } : consumer,
),
send_email: props.sendEmail?.map((config) => ({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this always at the top level instead of under bindings?

I understand it's at the top level in a wrangler.jsonc but the API docs seem to indicate this goes in the bindings array of the worker metadata object (link).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is at the top level. The API might change, I am not 100% sure.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were you able to run these? No problem if not, just wondering

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was missing the remote flag. I have now added that. Will test, and let you know.

Comment thread alchemy/src/cloudflare/worker.ts Outdated
Comment on lines +626 to +634
/**
* Restrict emails to a single destination address (mutually exclusive with allowedDestinationAddresses)
*/
destinationAddress?: string;

/**
* Allowlist of destination addresses (mutually exclusive with destinationAddress)
*/
allowedDestinationAddresses?: string[];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit of a nitpick but generally if properties are mutually exclusive, we like to model that at the type level.

}>;
}>(
`get worker "${name}"`,
api.get(`/accounts/${api.accountId}/workers/workers/${name}`),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love to see the new Workers API being used!

@john-royal

Copy link
Copy Markdown
Contributor

Appreciate the contribution but going to have to close this for now. I'll incorporate what you've done into #1319 and make sure you're credited as well.

Just a note: in Alchemy, any bindings should always be defined in WorkerProps["bindings"] - this ensures consistency and lets us infer the type of your env object, which is important to us (Alchemy favors inference over codegen as a design tenet).

Happy to discuss further here or in Slack/Discord.

@john-royal john-royal closed this Feb 25, 2026
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

Successfully merging this pull request may close these issues.

2 participants