"Invalid API key" when running an API in a container

I have Sentry running locally in a container. If my API runs locally on my machine i.e. outside a container, I see errors on Sentry as normal. Dockerizing the API and passing the DSN as an environmental variable (I checked, it’s there) http://publickey@my-sentry:9000/1 doesn’t work, with Sentry replying with “Invalid API key”. Same DSN as far as I can see (only difference is the host: localhost vs my-sentry).

My API is written in R, and everything works as it should, except Sentry inside a container.