Code.js not updating

I don’t think it is Antivirus now. Windows firewall off helps but not the complete solution. More here…

The StackOverflow article you refer to is from 2010. However, clearing the cache is still the first thing to do.

What version of AppStudio are you using? There were recently big changes in this area.

Are you deploying to your own server or Volt?

Latest version. Own server.

I have been getting this recently too. The index.html file updates immediately but the code.js takes 1 to 2 hours before it will update. In the meantime the app is full of errors - difficult to explain to an end user. Own server. Happens mainly on desktop (Windows, Chrome and Opera) but also on Android.

I’ve have a problem with Chrome not clearing cache, even with right click on reload button, selecting clear cache and hard reload… The only way I know to be sure your internal cache is really cleared for a site is to go to the site in Incognito mode. Incognito ignores the cache and updates the cache. I’m still looking into my problem - if I find something I’ll post it.

Same here, last week, two computers on same Chrome account would not update code.js. Firefox, IE, Edge were ok. Tried everything including reinstalling Chrome on PC. A third computer not on the same Chrome account updated. The next day everything was back to normal. Was using Version 6.x of AS. When I redeployed to a new Folder name not used before, it would update. I think I tested on Android without issue. AS 7.x no issue but I didn’t have any older deployed apps to test.

John

I bet MicroSoft sent out an update to the wininet API that is not working recently. I’m betting MAC users are not seeing this. I’m on Win10.

You guys have any joy with the firewall turned off?

I’ve had problems with my code not updating on my server too. I’m running the latest NSB version.
When this happens, i move a control such as a button to a different position on the screen then deploy again, and then everything updates as it should. Not sure why.

Whose server are you deploying to?

Don’t suppose we could write an Ajax call within the app to download code.js? Assume an ajax call won’t save code.js to where it needs to be saved?

Issue just started on my Galaxy S9+ today. To date it had only been on pc and with my firewall off it is not happening much.

George is there any chance you could save a code.js version in the index.htm (or somewhere else) file? The app could compare the versions on loading to make sure it it running the correct code.js. Very frustrating wasting time “fixing” a bug when your fixes aren’t even going through.

Followup: A day later my code.js was updating again. Suggestion, if you have a Google account try logging into a different account. When I did that it worked the day it was failing on two computers logged into the same Google account. The third computer was on a different account. Maybe just coincidental but worth a try.

John

It always updates for me within a day later. On the plus side at least you know clients are getting the app update eventually.

This code.js issue just started on my S9+ after having no problems for months. Anyone have any joy with this issue?

I had a similar issues years ago which I fixed by amending/adding a .htaccess file to the root public html folder on my server. I’ve never had that problem since.

You can search for the issue online, but I found some info here to get you started:

Hope this helps.

1 Like

I’m using AWS and in the cloudfront service I set the TTL to 10 seconds max. with min as 0 seconds. That cleared all my problems on all devices. Realizing you’re probably not using AWS, look for TTL (Time To Live) settings for your site on the server. For example, AWS defaults to 1 day - 86400 seconds. As I mentioned above, incognito seems to be the client side solution in a pinch, but not useful.

AWS Cloudfront is particularly a problem in that it is yet another level of cache on the server side. So not only does the TTL settings in Cloudfront send the TTL settings to the client browser, but it also uses it on the server side where Cloudfront is a cache between the internet and your actual site (that may be hosted on S3, for example). Cloudfront does all this to reduce access to the actual site and these server caches are distributed worldwide for access speed.

This issue is becoming a big hassle for me the past week. Virtually no apps are updating on mobile and chrome on pc regularly needs a hard refresh to get the code.js file.

George, I was wondering if there could be a property in the project which enables developers to specify the name of the code.js file? I know you shouldn’t need to but this is a real hassle for some of us and certainly not good for our clients.

This is almost certainly a configuration problem at your end. What are you using as a server?

There isn’t any way to override the name of the code.js file. Even if there were, the same problem would probably happen with another name.

I changed the last line in index.html to say <script src="code2.js"></script> then renamed the file on server to code2.js and it worked fine. The problem would arise again, certainly but when it did the property could be changed.

I’m not sure what to answer with regards to the server. It is hosted, I think, on a linux server with cpanel being the front end for email accounts, security settings etc.

I’m sure it is but I know nothing of how to start fixing it. Is .htaccess anything to do with it?