Outbound HTTPS to api.anthropic.com blocked on Hobby plan
finnshortman
HOBBYOP

2 months ago

My Node.js service cannot make outbound HTTPS calls to api.anthropic.com. I get a "Connection error" at Anthropic.makeRequest on every attempt. Works perfectly locally. API key is valid with $19 credits. I'm on the Hobby plan.

Project: resplendent-gratitude

Service: future-proof-marketing

Repo: github.com/FinnShortman/future-proof-marketing

Error in logs:

Error handling message: Connection error. Error: Connection error.

at Anthropic.makeRequest (/app/node_modules/@anthropic-ai/sdk/core.js:337:19)

at async generateReply (/app/claude.js:41:20)

Local environment works fine. Railway deployment fails 100% of the time. Please check if outbound HTTPS is being blocked on this service.

Solved$10 Bounty

Pinned Solution

domehane
FREE

2 months ago

okay can you run this inside your railway service via railway cli ssh:

curl -v https://api.anthropic.com

that command will show where the connection is dying

6 Replies

Status changed to Open Railway about 2 months ago


Try enabling IPv6 outbound in your service settings.


0x5b62656e5d

Try enabling IPv6 outbound in your service settings.

finnshortman
HOBBYOP

2 months ago

Thanks, already tried enabling Outbound IPv6 in service settings and redeployed — same connection error persists. The error is specifically at Anthropic.makeRequest in the SDK, suggesting the TCP connection to api.anthropic.com is being refused or timing out before any response.


domehane
FREE

2 months ago

Hello finnshortman,

what version of @anthropic-ai/sdk are you on and does the error happen instantly or after a timeout?


domehane

Hello **finnshortman,** what version of `@anthropic-ai/sdk` are you on and does the error happen instantly or after a timeout?

finnshortman
HOBBYOP

2 months ago

Hi, SDK version is @anthropic-ai/sdk 0.39.0. The error happens instantly — same timestamp as the incoming message, no timeout delay. The error is: 'Connection error. Error: Connection error. at Anthropic.makeRequest (/app/node_modules/@anthropic-ai/sdk/core.js:337:19)'. Works perfectly locally, fails 100% of the time on Railway.


domehane
FREE

2 months ago

okay can you run this inside your railway service via railway cli ssh:

curl -v https://api.anthropic.com

that command will show where the connection is dying


domehane

okay can you run this inside your railway service via railway cli ssh: `curl -v https://api.anthropic.com` that command will show where the connection is dying

finnshortman
HOBBYOP

2 months ago

Legend! The SSH diagnostic was the key — found 3 hidden newline characters appended to my Anthropic API key in Railway's variables. Deleted the key, generated a new one, pasted it clean and it works perfectly. Thanks so much for your help!


Status changed to Open brody about 2 months ago


Status changed to Solved brody about 2 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...