-
Notifications
You must be signed in to change notification settings - Fork 63
Description
Reproduction Steps:
So far I've been able to reproduce this in GitHub Actions for every version from 3.5 up to 4.5.1. I am not able to reproduce the error locally for reasons that are still not clear to me. Further complicating things, this error is not occurring in my Rust based repository that is using Resend via GitHub Actions.
Runner Type: ubuntu-latest
Functions Impacted:
- I've been able to replicate this in GitHub Actions with the
get,send, andfetchRequestfunctions onResend.
Behavior
For GitHub Actions only when using the node SDK, I'm seeing the following error:
{"statusCode":400,"message":"API key is invalid","name":"validation_error"}
I find this to be problematic for several reasons:
- The same API key works just fine locally and in another GitHub Action using Rust
- The 400
statusCodetechnically corresponds to theinvalid_idempotency_keyerror, not thevalidation_erroror the "API key is invalid error" - I am not setting the
idempotencyKeyat all, anywhere.
Example Code
Here is the code I am using, which is working locally but not in GitHub Actions:
import * as dotenv from "dotenv";
import { Resend } from "resend";
dotenv.config();
const resend = new Resend(process.env.RESEND_API_KEY);
export const sendEmail = async (emailBody: string) => {
const emailResponse = await resend.emails.send({
from: "[email protected]",
to: "[email protected]",
subject: "Weekly Newsletter Template",
html: emailBody,
});
if (emailResponse.error) {
throw new Error(JSON.stringify(emailResponse.error));
}
};
I did not change the code above, but I saw failures start happening on 05/07/2025.
Theory
There do not appear to be any suspicious commits in the resend-node repository around this time. I've reviewed the idempotencyKey related code and all looks well there. I would say this appears to be server side related, but I checked my Resend logs and these requests are not even hitting the server. At this point, I have no clue what is going wrong here. Any help is appreciated.