Stripe Error: “Livemode of key does not match mode of account (hint: legacy testmode keys are not supported. Please use a sandbox.)”

I’m trying to test metered billing via an AWS Lambda function written in NodeJS. I get the following error message from Stripe:

Error processing metered billing event: StripeAuthenticationError: Livemode of key does not match mode of account (hint: legacy testmode keys are not supported. Please use a sandbox.)

I’m absolutely baffled as to why I’m getting this error because I’m using my test mode key for this. I’ve also been testing stuff via Stripe all day and everything has been working fine.

I thought for sure it had to do with the livemode: BOOLEAN attribute that the Meter Event Object has, so I explicitly set that as false for testing purposes:

        // Create the metered billing event with the v2 API (Custom Event Billing)
        const meterEvent = await stripe.v2.billing.meterEvents.create({
            event_name: 'product_creation', // You can use your custom event name
            payload: {
                value: 1,  // Increment by 1 product creation
                stripe_customer_id: stripeCustomerID  // Stripe customer ID
            },
            livemode: false  // IMPORTANT!!! --> make sure to set this to TRUE in the live mode.
            // this parameter must overtly be specified for TEST vs LIVE mode, for the meter event object.
        });

Nope, still getting this error.

Any ideas as why this may be happening and what the fix could be?

Thanks!…