RESULT_CODE_INVALID_CMDLINE_URL when running a react app - reactjs

I had a react app that was working fine before my computer was force shut. I am using npm start to serve my app in a local server. When I reopen my computer and start my server the first page( the "/" url) works fine, but when I push a new url to the history( props.history.push("/pages")), the browser freezes and it give me this error . This was in chromium and I even tried it with other browsers like firefox but the browser just freezes. Assuming the problem might be with my computer I have also tried other devices on the network and the same problem keeps happening. I have even cleared the npm cache by npm cache clean --force. But nothing solves the problem and it is frustruting to debug since nothing is printed on the dev tools and no error message is throwen by react. If some one has come accross such a problem would like to hear a suggestion.

This had happened to me a couple of times. This seems to keep happening in chrome browser when you have an array and you are pushing too many items to it (it is like
stackoverflow:)
). You may want to edit your question so that more people can benefit from these, it isn't actually a react problem. It is a limitation in browsers I guess. They should at least warn you about what the error is. so for anyone who wants to regenerate this problem use the following code in the chromium console or run any js script on your chromium browser.
let arr = [];
let arrcounter = 13;
for (let x = 1; x <= arrcounter; x) {
arr.push(x);
}
This is an infinite loop as x isn't being incremented, which means an infinite amount of 1's are pushed to the array which causes the above error. This atleast was in my case. There might be other reasons for this problem to be caused, but check for such a mistakes in your code because neither your browser (which is a bammer) nor your editor notify you about such mistake. If this solves your mistake let me know.
As to how to debug your code.
You can start by commenting out all your code except the necessary react requirements then uncommenting each part in a controlled way to see which part of your code is causing the problem.

Related

A problem repeatedly occurred when reopening PWA in iOS/Safari

I'm developing a PWA (VueJS/Quasar) and, from time to time, face the following error when re-opening the app (saved on the home screen) after a while.
Black screen with: A problem repeatedly occurred on "https://..."
I have found some hints (memory/performance, css issues) and related questions (e.g. iOS safari crashing (a problem repeatedly occured)) but I have not fully understood how to trace down that problem.
Does anyone have a clear idea on how to tackle it? As said, it only happens once in a while.
While preventing the error in the first place is a priority, is there anything I can do to e.g. reload the app once this error occurs or is this fully out of my control as the app has crashed anyway?

browser.downloads.onChanged.addListener Doesn't work in Firefox?

I'm having some trouble with WebExtensions in Firefox. I've got some code to track downloads, and it's working in Chrome, but not in FF.
I've boiled the code down to the minimal surface that works in Chrome but not FF:
function handleChanged(delta) {
console.log(delta);
}
chrome.downloads.onChanged.addListener(handleChanged);
Whether I use chrome.* or browser.*, the behavior remains the same: it doesn't work. I've tried executing this line:
console.log(chrome.downloads.onChanged.hasListener(handleChanged));
After adding the listener, and it does log a value of true. Oddly enough, adding an onCreated listener works just fine:
function handleCreated(delta) {
console.log(delta);
}
chrome.downloads.onCreated.addListener(handleCreated);
This yields the expected object dump in the console when a download is started. Unless I'm missing something extremely obvious, I'm inclined to think this is a bug. It is not mentioned to the incompatibilities list, and it is documented by Mozilla. The thing is, I don't see anybody else asking this question online, so I'm inclined to think a bug is unlikely and I'm messing something up.
If it helps, I'm running Firefox 51.0.1 (32-bit) on Windows 7 Enterprise x64 inside of VMWare Workstation on a Windows 7 Enterprise x64 host. I'm loading the extension using the "Load Temporary Add-on" button. It's not a problem with the core manifest or add-on itself, because three other types of listeners are working just fine. The script is running as a background script.
I appreciate any guidance. Thanks!

android.hardware.camera2 ERROR CAMERA IN USE

I'm using the google sample 'android-Camera2Video':
https://github.com/googlesamples/android-Camera2Video
The problem is that when the app is finishing the recording, sometimes it stucks for a moment, and then calls the onError() handler of the CameraDevice.StateCallback with 1 - 'ERROR_CAMERA_IN_USE' error code.
It does not happen every single time, it happens in about 90% of cases, and sometimes everything works fine with no errors. I couldn't find out on what it depends and how to resolve this issue. If anyone have met this problem before, please help.

Why do Selenium tests that pass locally fail on Browserstack specifying exact same browser?

I got a test that opens a webpage and does scraping.
It works. There's no question on that:
- Works on Phantomjs/Chrome/Firefox when run on my machine everytime.
However, when run on Browserstack (I want to cover 5 most popular browsers, several OS and even mobile devices, for the moment I specify the exact same browser and platform as on my machine to ensure first the test runs properly on Browserstack), the test SOMETIMES passes and SOMETIMES fails with different errors:
- Stale element
- No such element in cache
- Page fails to load after a submit
- etc
And almost never the same element or submit.
Which is making me wonder whether Browserstack has some inherent instability I'm not aware of. Has anyone seen this happen on Browserstack?
Welcome to BS. You get such errors because the environments on BS do lag a lot. They aren't giving much resources to their VMs so you will have to deal with it. Or put a lot of thread sleeps and special waits for your needs

Is it possible to blackbox all VM scripts in chrome debugger?

I'm trying to debug quite a complicated module in my angular app. I've set a break point at the start of a particular method hoping I could follow it through and see where it's giving me back an error. However, it keeps bringing me into the VM scripts (VM28337, VM30559, etc). I can assume these all work as they should, so I have no interest in seeing them.
I know I can blackbox certain scripts in chrome debugger, but there seems to be an endless amount of these VM scripts. Does anyone have any suggestions on how to circumvent these scripts?
This doesn't appear to be possible in any version of Chrome at the moment. However, I create a Chromium bug to request it get added: Chromium Issue 526239
A development-time-only workaround can be to override eval in your page -
(function ()
{
var originalEval = eval;
eval =
function (script)
{
return originalEval(script + "\n//# sourceURL=blackbox-this.js");
}
}());
And then blackbox ^.*blackbox-this.js$
Same for setInterval/setTimeout when it gets a string (but that is a bad practice anyway, right? ;))
Does that work for you?

Resources