AttributeError: This app has encountered an error. The original error message is redacted to prevent data leaks. Using st-gsheets-connection

Hi all,

I have an app that has been working fine until today. When I run streamlit run streamlit_app it runs perfectly, the issue happens when I try to deploy the app, dependencies are processed and mostly everything goes through but at the end I get this error: AttributeError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you're on Streamlit Cloud, click on 'Manage app' in the lower right of your app).

The traceback seems to be with the st-gsheets-connection, I reinstalled streamlit and st-gsheets-connections and the error still shows up. I modified the conn arguments since I thought it mightā€™ve been the arguments but there were not. I also modified the requirements.txt file but it also did not work. Hereā€™s the traceback for further reference:

File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script
    exec(code, module.__dict__)
File "/mount/src/reporte/streamlit_app.py", line 16, in <module>
    df = conn.read(worksheet="datos", usecols = [0,1,2,3])
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit_gsheets/gsheets_connection.py", line 570, in read
    return self.client.read(
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit_gsheets/gsheets_connection.py", line 207, in read
    return _get_as_dataframe(
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/caching/cache_utils.py", line 212, in wrapper
    return cached_func(*args, **kwargs)
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/caching/cache_utils.py", line 241, in __call__
    return self._get_or_create_cached_value(args, kwargs)
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/caching/cache_utils.py", line 267, in _get_or_create_cached_value
    return self._handle_cache_miss(cache, value_key, func_args, func_kwargs)
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/caching/cache_utils.py", line 321, in _handle_cache_miss
    computed_value = self._info.func(*func_args, **func_kwargs)
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit_gsheets/gsheets_connection.py", line 199, in _get_as_dataframe
    return get_as_dataframe(
File "/home/adminuser/venv/lib/python3.9/site-packages/gspread_dataframe.py", line 189, in get_as_dataframe
    all_values = _get_all_values(worksheet, evaluate_formulas)
File "/home/adminuser/venv/lib/python3.9/site-packages/gspread_dataframe.py", line 134, in _get_all_values
    data = worksheet.spreadsheet.values_get(

I have exactly the same problem since this morning, Iā€™m also using a google sheets connection:

TypeError: ā€˜AuthorizedSessionā€™ object is not callable

I already renewed my google service account keys and checked the connection, so the problem is not on that end.

@kajalthuis - Have you been able to resolve it?

No not yet.

My app does work when I run it locally, but not on streamlit cloud.

getting similar errorā€¦ Iā€™m not using google sheets, but Iā€™m noticing my error contains also has issues with the cachingā€¦ perhaps the issue is actually with the caching rather than your google sheets connection?

File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 534, in _run_script
    exec(code, module.__dict__)
File "/mount/src/carbon/app.py", line 284, in <module>
    legend_carbon_min, legend_carbon_max, dfs_carbon = access_wt.accesswt_moer(wt_bas, 2022, tabs)
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/caching/cache_utils.py", line 212, in wrapper
    return cached_func(*args, **kwargs)
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/caching/cache_utils.py", line 241, in __call__
    return self._get_or_create_cached_value(args, kwargs)
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/caching/cache_utils.py", line 267, in _get_or_create_cached_value
    return self._handle_cache_miss(cache, value_key, func_args, func_kwargs)
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/caching/cache_utils.py", line 321, in _handle_cache_miss
    computed_value = self._info.func(*func_args, **func_kwargs)
File "/mount/src/carbon/access_wt.py", line 70, in accesswt_moer
    tabs[i].write(f"Failed to retrieve data. Status code: {response.status_code}. Please try again.")

@antonioespinoza98 I found where the problem was. It has something to do with the gspread-pandas module, not sure exactly what.

I changed my code so I only use gspread instead of gspread-pandas and everything works fine again.

Mine was fixed too. But I did not correct my code, I rebooted it yesterday again and it worked. Not sure what was wrong from my end.

1 Like

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