Seeing TypeError: Failed to fetch dynamically imported module

I haven’t used my app in a while so it went to sleep and needed a wake up. After it woke up, I saw the error:

TypeError: Failed to fetch dynamically imported module: 
https://xxxx.streamlit.app/~/+/static/js/index.DzWF7M_0.js

I did not update code since my last visit so I expect it to continue working without any issue. It’s a simple app without any fancy bells and whistles. And it is private data so I can’t share the URL.
The app does work eventually after I hit “Reboot” a few times. But it also keeps failing unpredictably with a similar error. Is there some kind of cache that I need to clear? If so, where is it and how can I clear it?

1 Like

May we see the contents of your requirements.txt

Hi, I have been seeing the same error on a few different apps over the last week or so. It takes several refreshes for the error to go away. It also takes quite a long time for the app to start up, and that usually requires at least one refresh as well. These apps were booting up fine about 2 weeks ago and the code hasn’t changed.

Here are the contents of requirements.txt files for 2 of the apps:
App1:
google-generativeai
streamlit
Pillow
pytesseract

App2:
streamlit
pandas
deepgram-sdk
requests
openai
plotly
plotly-express
matplotlib
seaborn
networkx
pyvis
datetime
pypandoc
python-docx
numpy

Thanks for any help with this.

My requirements.txt file has the following three items:

biopython
pandas
streamlit

I am having the same problem, and also require pandas

I am also seeing this issue lately. My requirements:

streamlit 
watchdog 
streamlit-extras
plotly 
scipy
# 23-12-12 until at least 24-10-04: StreamlitAPIException: Streamlit only supports Bokeh version 2.4.3, but you have version 3.3.2 installed.
bokeh==2.4.3

I’m seeing the same error. Fairly regularly, in production we see the following error rendered instead of several streamlit components:

TypeError: Failed to fetch dynamically imported module: https:///static/js/index.B2Xocyf.js

The value after static/js/index. varies, we’ve also seen CbuYSrVP.js.

Unfortunately, we have not been able to reproduce the problem. Is this possibly an issue with either deploying a new version of our app, or specifically deploying a new version of our app with an updated version of streamlit?

I have created a Github issue but it was closed.

+1 for this error. Same issue at my end. My requirements:
streamlit
psycopg2
openai

Having the same problem. This happen very often in random place :frowning:
Our reserch: this problem appears in chromium browsers only. Looks like it concerns the next problem: there is limit of loading resources per page, The socket pool has a limit of 6 sockets per host, but certificate errors always make two connections in a row. First they get a certificate error, then they add the certificate to allowed_bad_certs and retry, so browser infinite loop until the requests get aborted.
for more info here Chromium
The issue occurs in case of self signed certificate only.
The questions - is it possible to reduce number of resources streamlit loading? it will fix the problem.
By the way, we have to use self signed certificate only only because of another bug - it is not possible copy/past into data_editor without it, if it is not a localhost! That’s also big streamlit problem :frowning:
Please, help!

Hey all,

I was having the same issue with my app and to me this seems to be a browser cache related as when I try the app with incognito mode, I do not get this error after seeing it in the normal browser mode.

It seems like this happens with just Date or Time type fields in my case. Is that consistent with what others are experiencing?

I didn’t restart the app at all. Simply switching to incognito mode after getting the error on normal mode worked for me.

I wonder if there is a way to enable config within app to bypass browser cache and if that is a good approach to solve this.

Any pros / cons that you all can think with this approach?

UPDATE: Confirmed this is a browser cache issue as after clearing the cached files and images, the functionality returns to as expected in the normal browser mode.

An update on my earlier comment. We recognized that this was being caused by rate-limiting in the NGINX server that is proxying requests to our streamlit server. Streamlit is issuing many requests to get these chunked assets, thus tripping the rate-limiting. We relaxed the limits and avoided the issue now.

On the note of caching, we were able to replicate the issue in a private window with no caching, at least in our case.