Hi All! I tried to run growthbook-proxy in the ECS...
# announcements
i
Hi All! I tried to run growthbook-proxy in the ECS but I received this error below: {"level":50,"time":1683239035672,"pid":30,"hostname":"ip-xx-xx-xx-xx.ec2.internal","err":{"type":"HTTPError","message":"Response code 401 (Unauthorized)","stack":"HTTPError: Response code 401 (Unauthorized)\n at Request.<anonymous> (/usr/local/src/app/node_modules/got/dist/source/as-promise/index.js11842)\n at processTicksAndRejections (nodeinternal/process/task queues96:5)","name":"HTTPError","code":"ERR_NON_2XX_3XX_RESPONSE","timings":{"start":1683239035652,"socket":1683239035652,"lookup":1683239035652,"connect":1683239035654,"secureConnect":1683239035659,"upload":1683239035659,"response":1683239035672,"end":1683239035672,"phases":{"wait":0,"dns":0,"tcp":2,"tls":5,"request":0,"firstByte":13,"download":0,"total":20}}},"msg":"polling error"} I set the env GROWTHBOOK_API_HOST, SECRET_API_KEY and GROWTHBOOK_API_HOST part of growthbook proxy , in the growthbook (API and UI ) I set env - PROXY_HOST_PUBLIC and SECRET_API_KEY I created the DNS in route53 aws for url api and ui. Could you please help me? Is there some configuration I need to do?
f
@happy-autumn-40938 do you have any ideas?
h
Hmm odd. I'm assuming that you're using the Docker image to run GrowthBook Proxy (as opposed to either running the source code or our NPM package on ECS). The error
polling error
occurs when the proxy can't connect to your public API endpoint (in this case, to get a list of valid SDK Connections from GrowthBook). It's basically an initial handshake between the proxy and the GB app. It relies on both
GROWTHBOOK_API_HOST
and
SECRET_API_KEY
being set correctly, although in your case it sounds like this may already be set. I might start there, double check those values. Also, on the GrowthBook side, you'll need both
PROXY_ENABLED=1
and
PROXY_HOST_PUBLIC
set (seems like you've probably already done this as well, although you didn't mention PROXY_ENABLED). From the stack trace above there isn't quite enough information to determine whether the proxy is actually reaching the GB app or not, although a 401 might indicate that at least you're able to hit the correct server. You could also check your GB app logs and see whether GrowthBook is actually receiving the request from the proxy on the public API endpoint (specifically the proxy will try to reach
$GROWTHBOOK_API_HOST/api/v1/sdk-connections?withProxy=1&limit=100
). The GB app will probably log an error of some sort if it's returning a 401 on this endpoint. If this doesn't work, we might try a GET to the above endpoint from within your network (ex: from a custom ECS instance). You'd need to add a header to make this request work:
Copy code
Authorization: Bearer $SECRET_API_KEY
If the manual GET also fails, then we've got a networking problem, which could be Route53 or something else entirely.
147 Views