AgentError: Invalid certificate: Signature verification failed with NodeJS

Bringing the conversation over from this thread

We use this setup pattern for our tests. @kpeacock Is there anything you see that might look off or result in Invalid Certificate errors?

  // Returns a factory function for interacting with a canister for a specific identity.
  function factory<T>(
    idlFactory: IDL.InterfaceFactory,
    canisterName: string
  ): (identity?: Identity, network?: Network) => ActorSubclass<T> {
    return (
      /** The identity to use. Defaults to anonymous. */
      identity: Identity = new AnonymousIdentity(),
      /** The network to use. Defaults to local. (ic | local) */
      network: Network = "local"
    ) => {
      const agent = new HttpAgent({ host: host[network], identity });
      const ids = Canisters.IDs[canisterName as keyof typeof Canisters.IDs];
      const canisterId = ids[network as keyof typeof ids];
      if (network === "local") {
        agent.fetchRootKey();
      }
      return Actor.createActor<T>(idlFactory, { canisterId, agent });
    };
  }

  export const myActor = factory<MyActorType>(MyActorIDL, "myActor");

  export function randomUser(): User {
    const key = Ed25519KeyIdentity.generate();
    return {
      key,
      call: {
        myActor: Actors.myActor(key),
      
      },
    };
  }