Google Sheets API requests time out only from Railway
xkyoyah
HOBBYOP

3 hours ago

My Python Discord bot consistently times out when reading Google Sheets from Railway.

Requests to sheets.googleapis.com through gspread, including Client.open_by_key and Worksheet.get_all_values, reach a 15-second ReadTimeout. The issue occurred in both US West and US East.

Troubleshooting completed:

  • Enabled Google Sheets API and Google Drive API
  • Created a completely new Google Cloud project and service account
  • Shared the spreadsheet with the new service account
  • Replaced the Railway GOOGLE_CREDENTIALS_JSON
  • Confirmed authentication succeeds
  • Confirmed Railway can identify the spreadsheet and load all 12 worksheet names
  • Redeployed with only one replica
  • Ran the exact same bot.py, spreadsheet ID, and Google credentials locally on Windows

The local bot immediately connected to Google Sheets, loaded all 12 worksheets, restored its data, and Discord spreadsheet commands worked. Only the Railway deployment times out when reading worksheet cell values.

Please investigate the outbound connection or host/network route from my Railway service to sheets.googleapis.com. I am a paying subscriber and would also like to know whether service credit is available for the downtime.

Solved

1 Replies

Status changed to Awaiting Railway Response Railway about 2 hours ago


Railway
BOT

2 hours ago

Your own troubleshooting report shows that authentication, spreadsheet identification, and loading all 12 worksheet names all succeeded from the Railway container. Those calls traverse the same outbound path as get_all_values, so if the egress route to Google were broken, none of them would have worked either. The 15-second cutoff on the larger data read, reproducing across both US West and US East, points to the client-side ReadTimeout configured in gspread (or the underlying urllib3/httplib2 transport) rather than a network fault, since a host-level egress problem is per-host and would not follow the service across regions. The two places worth checking are the read-timeout value in your HTTP transport configuration and the Google Cloud quota console for the Sheets API on the project tied to your service account.


Status changed to Awaiting User Response Railway about 2 hours ago


Status changed to Solved xkyoyah 4 minutes ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...