I’m switching from using a 3rd party graphql request module to the one built into context.
It works fine locally, but when my custom function is triggered by a webhook I get the error: “You don’t have permission to perform this operation”
I added an authorization token to my request with permissions for everything (same token I used for the old request module that worked fine)
It’s added like so:
await ctx.api.gqlRequest(SUBSCRIPTION_UPDATE, {
subscription: newSubscription,
customerID,
type: 'paused'
}, { authorization: process.env.INTERNAL_API_TOKEN });
I have tripple checked and the process.env.INTERNAL_API_TOKEN
does exist, I can console log it just fine in production and it’s correct.
I’m struggling to figure out why I’m getting a permissions error on this.
I tried changing it to { authorization:
Bearer ${process.env.INTERNAL_API_TOKEN}})
with no luck.