I am using the gadget client in cloudflare and it is working fine in development but giving an error

I keep getting the following error even though I copied and pasted the production development keys multiple times carefully and also made sure it has the correct access scopes: Failed to get shop details: [GraphQL] GGT_INVALID_API_KEY: Invalid API key. Please ensure you're passing an API Key directly copied from the Gadget Editor, which is a string starting with gsk-.
4 Replies
safwan
safwanOP2mo ago
fixed it, I included the env variable parameter and it worked this isn't part of the documentation and took me a while to debug this, make sure to update this
airhorns
airhorns2mo ago
hey Safwan which env variable are you talking about that wasn't obvious to you?
safwan
safwanOP2mo ago
when you instantiate a client there's a parameter for environment, turns out its development by default. Set it to production explicitly and it worked Might attach documentation references later
Chocci_Milk
Chocci_Milk2mo ago
Are you talking about the NODE_ENV env var? That should be in each environment by default.

Did you find this page helpful?