Closed vcombey closed 1 year ago
I'm getting this too. It seems the backend is trying to redirect to "https://beta-api-eu.customer.io" but the client is not following redirects. I believe this is an EU only issue.
if you log the full error you get:
body: '{"errors":[{"detail":"wrong datacenter","status":"301"}]}'
A workaround would be to use the REST api instead.
Looking further it appears request.ts
is using node https, this package has no built-in feature to follow redirects and does not follow redirects by default. You have to do it manually.
This is a pretty serious issue since if the backend wants to make a simple redirect, that could brick entire apps relying on cio. Please look into it.
Thanks for the info @asplunds, I have a PR ready with #135.
The real root cause here, however, is that you're not configuring the client to use the EU region (it defaults to the US). You should be creating the client like so:
const { APIClient, RegionEU } = require('customerio-node');
const client = new APIClient("********************************", { region: RegionEU });
Setting up the correct region avoids unnecessary redirects
Thanks for the response @mike-engel, this was a mistake on my part I should've configured my client to use the EU region. I'm glad this was caught and being fixed however, since following redirects is still important regardless of region.
Fix released with 3.5.1
. Thanks y'all
This code logs: 301 Unknown error
I'm using "customerio-node": "3.4.1",
I don't know what to do