ERR_REQUIRE_ESM / Cannot use import statement outside a module
ERR_REQUIRE_ESM / Cannot use import statement outside a module
require() will fail.Fix: use dynamic import in CommonJS:"type": "module" to package.json.fetch / FormData / Blob / AbortController is not defined
fetch / FormData / Blob / AbortController is not defined
'apiKey' must be a non-empty string
'apiKey' must be a non-empty string
- The environment variable is not loaded. Ensure
BOSONMAIL_API_KEYis set before the process starts. - In Next.js, do not use
NEXT_PUBLIC_BOSONMAIL_API_KEY. That prefix exposes the value to the browser bundle. Use a server-only variable instead. - In Cloudflare Workers, read the key from
c.env.BOSONMAIL_API_KEYinside the handler, not fromprocess.env.
Request timed out after 30000ms
Request timed out after 30000ms
- If you have a
messageId, callgetEmailStatusto check whether the message was accepted. - If you do not have a
messageId, log the failure for manual review. - Only resend after confirming the previous attempt did not succeed, accepting the small risk of duplication.
Email must contain text or HTML content
Email must contain text or HTML content
body argument did not include a non-empty text or html field.Fix: provide at least one of the two. For best client compatibility, provide both.Invalid content for attachment
Invalid content for attachment
content is not a Blob, ArrayBuffer, or Uint8Array.Common mistake: passing a string, a fs.ReadStream, or a base64 string directly.Fix: read the file into a Buffer first.Attachment exceeds size limits
Attachment exceeds size limits
sendEmail succeeded but the recipient never received the email
sendEmail succeeded but the recipient never received the email
sendEmail result means the API accepted the message. It does not mean the message was delivered.Fix:- Call
getEmailStatuswith themessageIdto track the delivery pipeline. - Ask the recipient to check spam or junk folders.
- Verify the recipient address is correct.
- If the status is
failed,bounced, orrejected, review the error details and correct the request.
messageId is undefined in the result
messageId is undefined in the result
messageId, emailId, or message_id field.Fix: this is rare but possible. You cannot look up status without a message ID. Log the id field if present, and contact support@bosonware.com with the timestamp and response details.getEmailStatus returns not_found
getEmailStatus returns not_found
getEmailStatus returns invalid_response
getEmailStatus returns invalid_response
id, status, or delivery_status.Fix: this indicates an unexpected API response shape. Report it to support@bosonware.com with the message ID, SDK version, and timestamp. Do not retry blindly.JSON send issues on SDK 0.2.0
JSON send issues on SDK 0.2.0
to, cc, and bcc as arrays in JSON requests. Version 0.2.1 fixed this to send comma-separated strings.Fix: upgrade to @bosonware-ent/bosonmail@0.2.1 or later.Content-Type manually set breaking multipart
Content-Type manually set breaking multipart
Content-Type: multipart/form-data manually without a boundary, the server cannot parse the body.Fix: let the HTTP client set the multipart header automatically. When using fetch with FormData, do not set Content-Type at all.Contacting support
When you open a support request, include:- SDK version (for example, 0.2.1)
- Runtime and version (Node.js 20, Bun 1.1, etc.)
statusCodeanderrorMessagefrom the resultmessageIdif available- Timestamp of the request (with timezone)