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

🐛 BUG: ForwardableEmailMessage is missing reply from its type definition #2283

Closed
charliez0 opened this issue Jun 18, 2024 · 7 comments · Fixed by #2414
Closed

🐛 BUG: ForwardableEmailMessage is missing reply from its type definition #2283

charliez0 opened this issue Jun 18, 2024 · 7 comments · Fixed by #2414
Assignees
Labels
types Related to @cloudflare/workers-types

Comments

@charliez0
Copy link

charliez0 commented Jun 18, 2024

The ForwardableEmailMessage interface is defined as follows:

interface ForwardableEmailMessage extends EmailMessage {
  readonly raw: ReadableStream<Uint8Array>;
  readonly headers: Headers;
  readonly rawSize: number;

  setReject(reason: string): void;
  forward(rcptTo: string, headers?: Headers): Promise<void>;
}

As per https://developers.cloudflare.com/email-routing/email-workers/runtime-api/#emailmessage-definition this type definition should also include a reply method: reply(message: EmailMessage): Promise<void>;, but it doesn't.

If the docs are the correct source of truth, we should update the ForwardableEmailMessage type definition to reflect that.

@charliez0 charliez0 added the types Related to @cloudflare/workers-types label Jun 18, 2024
@CarmenPopoviciu
Copy link
Contributor

hi @charliez0,

can you please use our issue template to provide more details about the issue you are reporting? it is very hard for us to address any issue without a proper understanding of it.

thank you

@charliez0
Copy link
Author

hi @charliez0,

can you please use our issue template to provide more details about the issue you are reporting? it is very hard for us to address any issue without a proper understanding of it.

thank you

the issue template is empty, idk why

L4285:4311

declare interface ForwardableEmailMessage extends EmailMessage {
  /**
   * Stream of the email message content.
   */
  readonly raw: ReadableStream<Uint8Array>;
  /**
   * An [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
   */
  readonly headers: Headers;
  /**
   * Size of the email message content.
   */
  readonly rawSize: number;
  /**
   * Reject this email message by returning a permanent SMTP error back to the connecting client including the given reason.
   * @param reason The reject reason.
   * @returns void
   */
  setReject(reason: string): void;
  /**
   * Forward this email message to a verified destination address of the account.
   * @param rcptTo Verified destination address.
   * @param headers A [Headers object](https://developer.mozilla.org/en-US/docs/Web/API/Headers).
   * @returns A promise that resolves when the email message is forwarded.
   */
  forward(rcptTo: string, headers?: Headers): Promise<void>;
}

missing reply() attribute

@charliez0
Copy link
Author

@CarmenPopoviciu

@charliez0
Copy link
Author

any progress?

@CarmenPopoviciu CarmenPopoviciu changed the title no reply() from ForwardableEmailMessage 🐛 BUG: ForwardableEmailMessage is missing reply from its type definition Jul 16, 2024
@CarmenPopoviciu
Copy link
Contributor

hi @charliez0,

thank you for providing the clarifying details. I understand now what the issue at hand is and have updated the GH issue title/description to reflect that.

I've assigned the issue to myself, and should have a fix PR up this week! I'll update here :)

@CarmenPopoviciu
Copy link
Contributor

If the docs are the correct source of truth

they are, I checked!

@CarmenPopoviciu
Copy link
Contributor

this fix should be out with the next workerd release, and available in workers-sdk with next week's release 🎉

thx again @charliez0 for reporting this <3

ns476 pushed a commit to ns476/workerd that referenced this issue Aug 2, 2024
The `ForwardableEmailMessage` interface should expose a
`reply` function, but it currently doesn't.This commit adds
the missing function to the interface definition.

Please refer to https://developers.cloudflare.com/email-routing/email-workers/runtime-api/#emailmessage-definition

Fixes cloudflare#2283
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types Related to @cloudflare/workers-types
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants