DOMError localforage indexeddb cases? - javascript

Today I had an error type: DOMerror exception thrown. Leaving the browser in blank page.
After doing some research I see in w3c that it should be used exclusively for indexeddb exceptions.
I actually removed cookies clear local storage and cache. And the problem does not happen anymore.
This is some more information I have of this Issue in the moment it happen:
message: "The requested version (1) is less than the existing version (2)."
(anonymous function)#app.js?0.1:1
(anonymous function)#vendors.js?0.1:16229
flush#vendors.js?0.1:16513
drainQueue#vendors.js?0.1:14819 DOMError
Where vendors is third party libraries in a bundle, and app is my application bundle.
I am trying to reproduce the error right now, but is hard to reproduce as it looks like a bad handling with persistance data on client, and the client has cleaned cookies / cache / localstorage to keep on working.
When does Dom error exception thrown on an application when using localforage?

"The requested version (1) is less than the existing version (2)."
--> this means your indexeddb database is currently in version 2 and you are trying to open it in version 1.
It is not allowed to open a database in a lower version when working with indexeddb

Related

Occasionally getting Reference Error in Javascript console

I am occasionally getting different types of Reference errors logged in chrome console.
For eg: require not defined
Cookies not defined
lozad not defined
The code is bundled in static-internal-bundle.js which is a combination of 7 different util files and minified using gulp-minify.
This error is coming mainly when the url is hit from paid.braintree.com Ad urls and has utm_source, utm_medium and utm_campaign as query parameters.
This error is not consistent and mostly does not reoccur if the site is refreshed.
Also, it has been logged in sentry for all types of devices and Os for over 1.5k times in 6 months. Though it gets logged in console, nothing seems to break on the webpage.
What could be the possible reasons for this type of error?
<script type="text/javascript" src="https://static.pens.com/576801d7b3a368c06ba1944c07fe260b970da596/build/static-internal-bundle.js"></script>
This is the script that gets added into the page in which the error is coming.
I would add this as a comment but StackO won't let me without 50+ rep... I'll edit as needed.
Possibly the error could be in using "require" on the browser side, as browsers do not implement require
This sounds like a problem I have had with Babel, if it is being used I would try updating.

SMART on FHIR client-js: Invalid Character Error on IE11

Note: The issue is also reported on GitHub. Please take a look at Git issue as well for current progress/investigation.
I'm using fhir-client v0.1.15 to develop a SMART on FHIR web application that would run in EHR launch scenario. For example in Epic Hyperspace simulator that uses IE to run the SMART application.
While testing my application locally(localhost) on IE11, I get a JavaScript error from within fhir-client.js.
SCRIPT1014: Invalid character
File: fhir-client.js, Line: 38113, Column: 3
Below are the two lines from code. 38112 & 38113 in order:
var ret = Adapter.get().defer();
var state = JSON.parse(sessionStorage[params.state]);
Any solution or workaround would be much appreciated.
Updated
Upon further investigation we found that sessionStorage is empty when line with JSON.parse executes. However, strange thing is why/how sessionStorage gets empty after redirection from authorization server. This only happens with IE11, everything works fine on Chrome though.
PS. Can someone please add a new tag SMART or SMARTonFHIR?
Though I couldn't find the exact root cause and solution but let me share the findings that helped me resolve this issue somehow.
The issue doesn't exist when I test my SMART application with redirect_uri(in FHIR.oauth2.authorize call) set to a staging server URL instead of localhost.
PS. I’m open to better, and more qualified answers for acceptance.

ExtJS: Empty File Name (only .js?_dc=20181..) - 404 Error

For a long time I keep facing with this problem and unfortunately sencha forums is not helping anything about. Therefore I had to bring up here.
I'm try to developing a simple weather panel. During displaying application on localhost environment it works all good but when it goes to live version it gives this error below and whole application is not working;
GET http://www.myapp/.js?_dc=20180112155627 404 (Not Found)
fetch # (index):89
fetch # (index):99
loadSync # (index):103
load # (index):103
loadEntries # (index):95
processRequest # (index):85
loadSync # (index):85
load # (index):85
As environment we are using Jenkins and classic toolkit during release version and this is Jenkins' commands;
Started by GitLab push by nengin
+ sencha app build classic
I've used Geolocation feature for weather panel but because of this problem I thought it keep raises error so I've take it out but still application keep give this error. On sencha forums they've suggested to me
it happens because of a missing file/ required file. Use sencha app build testing to find out which file is missing. As well comment modern toolkit statements on app.json to avoid errors related with unnecessary classes.
Well.. I did all but still if I'm not disabled weather-panel item on Dashboard class and push it to repository, Jenkins takes commit and build the live version to internet. And keep gives this error above!
Below you will find some code snippets of weather-panel, what could exactly be the reason for this error? I really need some idea.
Here is whole code blocks of weather panel # http://www.text-share.com/view/b53bd4fd
Thanks in advice.
UPDATE
Through #Alexander's comment:
So I've got this WARN on console: [W] [Ext.Loader] Synchronously loading 'Ext.data.proxy.JsonP'; consider adding Ext.require('Ext.data.proxy.JsonP') above Ext.onReady bootstrap.js:867
I've used JsonP on weatherdata class and it doesn't include JsonP inside requires. Now I've added JsonP and now the WARN is gone! So will it run without empty-file error on server with compiled application?
#Alexander 's comment has been the solution;
Please open the browser console, then work with the uncompiled app like it were the compiled app, and check for any occurrences of "Synchronously loading ..., consider adding ..." warnings. Make sure to fix all these warnings, because they cause the issue.

XHR request from previous Capybara js spec surfacing (and failing) in next spec

We're using Chrome headless with Capybara and Selenium for three js feature tests.
We're having a predictable (only on CI) failure when one specific js test (using xhr) follows another which also uses xhr (see https://github.com/thredded/thredded/tree/separate-out-js-from-non-js-in-ci for the code or https://travis-ci.org/thredded/thredded/jobs/302376004 for a sample run).
The server error is always being surfaced in the next spec "User creates new topic with title and content" but the url is evidently from the previous spec "User replying to a topic starts a quote-reply (js)".
The obvious thing is that there is a race condition between a request that falls off the end of the spec and happens after DatabaseCleaner.clean. However, my understanding is that with Capybara 2.7+ [1] after_each should happen after a reset_session! which should prevent this precise problem. In any case I am pretty sure there is nothing in the page that could be creating this request (we have a specific wait/test for the completion of this ajax request).
This is happening with 3 different databases and 3 different rails versions (4.2, 5.0, 5.1).
We've upgraded to latest Capybara.
Have tried disabling turbolinks, adding in a massive (10s) sleep at the end of the offending spec... Have tried manually resetting sessions too.
Must be missing something. Any pointers?
[1] https://github.com/teamcapybara/capybara/pull/1637 referenced from https://bibwild.wordpress.com/2016/02/18/struggling-towards-reliable-capybara-javascript-testing/
UPDATE: Have added references to xhr, as another (new) js spec is having the problem, and that it isn't the first two requests (login form, and post to login) that is surfacing the error, but the first xhr request that surfaces the error. In the new case the xhr that is getting requested is being requested with POST in the subsequent spec even though it was originall requested with GET
Looks like it was a chromedriver bug.
We fixed this by upgrading chromedriver (on travis) to v2.33 (linux).
https://travis-ci.org/thredded/thredded/builds/302431113
The previous version was v2.31. Oddly we couldn't get this to break locally with 2.31 (mac).

DOM exception error 11 on swapCache()

I am playing with an application cache and having problems with the swapCache function.
I have created the world's simplest cache manifest file:
CACHE MANIFEST
# Timestamp: 2013-03-01 11:28:49
CACHE:
media/myImage.png
NETWORK:
*
Running the application for the 1st time gives me this in the console:
Creating Application Cache with manifest http://blah_blah/offline.appcache
Application Cache Checking event
Application Cache Downloading event
Application Cache Progress event (0 of 1) http://blah_blah/media/myImage.png
Application Cache Progress event (1 of 1)
Application Cache Cached event
All well so far. Then I swap out the image and change the timestamp in the manifest file and get the following:
Adding master entry to Application Cache with manifest http://blah_blah/offline.appcache
Application Cache Downloading event
Application Cache Progress event (0 of 2) http://blah_blah/media/myImage.png
Application Cache Progress event (1 of 2) http://blah_blah/Widget/?invoke=myWidgetFunctionName
Application Cache Progress event (2 of 2)
Application Cache UpdateReady event
At which point the applicationCache.swapCache() function is called giving me a DOM exception 11 error.
MIME types all correctly configured on the webserver.
Anyone got any ideas / can point me in the right direction?
(I have read all the commonly linked appcache stuff online and can't see what am I doing wrong)
Thanks!
EDIT:
As I mentioned in the comments below, setting the expires headers on my web server for *.appcache files to expire immediately seems to have it working although I am still getting the DOM exception error(!?). I found the following blog entry which may help:
Possible Fix for Offline App Cache INVALIDSTATEERR
...but I have no idea how to set the MIME types client side. My google-Fu skillz have deserted me. Anyone?
I had the same issue. For a while I just disabled the cache if the browser was not chrome, but then I decided to try again, setting the mime-type as suggested. Firefox no longer throws an exception when I call swapCache(), and the whole refreshing process now works as expected. The mime-type has to be set server-side since the request isn't initiated from your web page, but the browser, so you have no control over how it reads the response. You have a couple options here. If you are using apache or IIS, you can do as koko suggested. If you are using a framework that handles routing for you and you configure the mapping of URLs to responses, such as rails or a python wsgi server, then you can typically set the content type manually. Here is my snippet of what I am using in my Python app using Bottle.py (WSGI based):
# BEFORE
#bottle.route(r"/<path:re:.+\.(manifest|appcache)>", auth=False)
def serve_cache_manifest(path):
return bottle.static_file(path, SITE_DIR)
# AFTER
#bottle.route(r"/<path:re:.+\.(manifest|appcache)>", auth=False)
def serve_cache_manifest(path):
return bottle.static_file(path, SITE_DIR, mimetype='text/cache-manifest')
Bottle comes with a utility function that handles returning static files that I am using. It has an optional parameter to set the mime-type.
tl;dr If you can't add the mime-type to your server configuration, you can almost always set it in your server side code (if you have
any).
I would suggest trying to comment out the catchall NETWORK whitelist.
NETWORK:
# *
The * would seem to require network access for all file, according to
https://developer.mozilla.org/en-US/docs/HTML/Using_the_application_cache
I commented out all NETWORK entries for now for a simple web application of mine and it works well.

Categories

Resources