Skip to content

Receiving 400 validation_error when running in GitHub Actions #522

@jimmyceroneii

Description

@jimmyceroneii

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, and fetchRequest functions on Resend.

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 statusCode technically corresponds to the invalid_idempotency_key error, not the validation_error or the "API key is invalid error"
  • I am not setting the idempotencyKey at 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions