App.py functions stopped working 11/11/23 out of nowhere

I have a live streamlit cloud app located here: https://commish.streamlit.app/
The public github is here: GitHub - jeisey/commish

The app is a free tool for anyone to connect their fantasy football league to ESPN, Yahoo, or Sleeper and generate a weekly recap in a character style of their choice (via GPT4). The primary functionality is authenticating your league and then generating a summary. The app was running without issues for 3 weeks and without making any changes to the code, the core functions of the app stopped working on 11/11/2023 (4 days ago). Specifically, all summary-generating functions seem to have ceased working for ESPN, Yahoo, and Sleeper. Unfortunately I’m unsure how to troubleshoot further than what I’ve done below:

I’ve tried the following:

  • adding DEBUG to the LOGGER for more information about where the errors occur now
  • clearing cache, removed data-cache functions, rebooting app, and even deleting & re-deploying the app (summary functionality still stopped working)
  • Locally, everything works. I can run this in a local environment without any issues

Below are the last few lines of my console logs where you can see the DEBUG statements

2023-11-15 20:20:56.129 Attempting ESPN summary generator...

2023-11-15 20:20:56.130 Creating new DataCache (key=fe338a9dbdab10527d24da399706750a, persist=None, max_entries=None, ttl=3600)

2023-11-15 20:20:56.131 Cache key: a84318a870fc62d1aea4ca1a7f126b97

2023-11-15 20:20:56.131 Memory cache MISS: a84318a870fc62d1aea4ca1a7f126b97

2023-11-15 20:20:56.131 Memory cache MISS: a84318a870fc62d1aea4ca1a7f126b97

DEBUG:nfl league:ESPN API Request: url: https://fantasy.espn.com/apis/v3/games/ffl/seasons/2023/segments/0/leagues/1491839 params: {'view': ['mTeam', 'mRoster', 'mMatchup', 'mSettings', 'mStandings']} headers: None 

Regardless of which league I connect to I get similar debug logs where it attempts to generate a summary and then breaks. In many cases the console log doesn’t even update as I try to authenticate other leagues. One thought was due to a lot of usage perhaps the APIs throttled/blocked, but it seems unlikely all 3 services would do that given the total users was about 250 people using the app ~4 times, collectively over 3 weeks. Not that extreme, and not enough to trip any of the API limits for those respective services.

My app.py file is where all the frontend logic occurs. This is leading to believe it may be due to some order of operations in caching & connecting, or perhaps some recent streamlit update? I checked the respective packages and nothing was updated 11/11/2023 so a bit unsure how else to troubleshoot this further. Any help/advice is appreciated, thank you.

Hey @philly91, welcome to the community :wave:

It looks like you’ve not pinned the version of openai in your requirements file. This is a guess, but it’s likely that your app restarted sometime last week and now uses OpenAI’s latest >=1.0.0 version.

Last week, OpenAI released v1 of their chat completions API that includes breaking changes. You should try migrating your OpenAI code using this guide and see if that fixes your issue:

Alternatively, you could try pinning the openai version to an older working one and restarting the app.

2 Likes

Thank you for the quick reply @snehankekre much appreciated. This seems to be the fix.

If you don’t mind me asking, what’s the general troubleshooting process you followed to discover this? I checked the versions for yahoo, ESPN, and sleeper wrappers I was using but didn’t check openai. The logs weren’t really giving me much to go off of even after adding more LOGGER statements to all the functions.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.