Web JavaScript app unable to find resources - javascript

A developer set up for me an online JavaScript app that is hosted on an AWS EC2 instance. It has been operating fine until a few hours ago when suddenly navigating to the website produces a blank page.
I expose the source, and it appears that the HTML is trying to load a JavaScript app (see screenshot 1), and when I look at the Web Inspector console, it seems that certain resources are not being found (screenshot 2). Strangely enough, I can't find these paths myself (except for app.js.map)
I have very limited knowledge about how web servers are run or how JavaScript works, but I do have some familiarity with AWS, and I have full access to the EC2 instance.
Considering nothing was intentionally or manually changed, I am guessing there must be some service that has stopped working.
Any ideas on how to troubleshoot this further?

Well this was a rather painful journey: nginx was dead.

Related

Problem run Flutter Web app in our company network

I'm trying to run my Flutter Web app on Local Area Network (intranet) in my work. But there is no internet access. And I have this issue “ Failed to load resource: net :: ERR_INTERNET_DISCONNECTED “. I think, problem is with canvaskit.js because my app try to download from internet. Do you have some idea how to fix it?
This is a common mistake when you use Flutter web within an Intranet that has no Internet access. I will try to explain it in detail.
In Flutter Web you can choose between two web renderers (more info here). The default one is CanvasKit, but there is also the HTML renderer.
The problem with CanvasKit web renderer is that when you start the application for the first time, it goes to unpkg.com and downloads two files: canvaskit.js and canvskit.wasm. Once downloaded, the browser caches them and Flutter doesn't need to download them again in the future.
But, if the app can't download these files, the application fails to start. Which is the problem that #TomášTorok mentions.
What are the solutions? There are two possibilities:
1 - Force your app to use the HTML web renderer, as it doesn't need to download anything over the Internet. This web renderer has some limitations that CanvasKit doesn't have, and vice versa (in this article they explain everything in detail)
To use the HTML in debug:
flutter run -d chrome --web-renderer html
OR if you want to build your app:
flutter build web --web-renderer html
2 - Download manually the canvaskit.js and canvaskit.wasm files from unpkg.com (example link), add them inside your project (inside /web folder), and force Flutter web to grab the local files and not download anything from the Internet.
It's a bit more work, but it's not complex either. You have the instructions in this link.
If I understood correctly;
There is nothing to do with flutter version or flutter channel. The error message is clearly explaining that internet is disconnected. The universal truth is you need a minimum speed internet to debug or release your flutter code development. Try to check the internet connection.
Reply back if this answer is helpful to you, also share how did you solved the issue.

Get Chromecast to run in a secure context when connected to local dev server

I have adopted a codebase for a Chromecast app for one of our major clients. This has been handed over to me because the original developer has recently left our company. Upon trying to do a handover, however, we were surprised to find that the Chromecast client (which is a simple JavaScript SPA) does not run when hosted by my machine! The content requires use of the navigator.requestMediaKeySystemAccess API for DRM-protected video, which is not available on my host, but is available on my ex-colleague's.
After much investigation, the root cause seems to the fact that the Chromecast does not deem my dev server's host (something like http://10.1.2.75:4301) a "secure context" - the navigator.requestMediaKeySystemAccess API is only available in such secure contexts. However, the old developer of this project has been connecting the Chromecast to their local dev server (something like http://10.1.2.89:4301) just fine for more than 2 years, he was completely surprised to find that it didn't work for anybody else. We ran numerous tests for different configurations, tried casting from different sources, connecting to different people's machines, etc. but whenever we inspected window.isSecureContext on his host it would return true - and on mine it would return false.
From my understanding, there should basically be no scenario where isSecureContext should be true on any kind of http connection, and yet this was very much the case on my ex-colleague's machine - and had been for a long period of time. If this hadn't been the case and this were a new project I was starting I would immediately say "we're going to need to develop this on some sort of HTTPS connection", and yet the evidence I have disproves this.
How can I get the Chromecast to trust my browser enough to expose this navigator.requestMediaKeySystemAccess API - it should be all I need to get this project working without some kind of local tunnel like ngrok (which is what I'm having to do at the moment, and it is causing all sorts of issues). In Chrome you can explicitly instruct a website to trust insecure content - is there a way that I can do this on the Chromecast device? Is there a way I can get it to trust a self-signed certificate or something?
Lastly, I can't realistically do much stuff at a network level like set up a private CA and provision certs to dev machines, etc, as we are a pretty small company with little-to-no in-house architecture (so that we needn't maintain anything). I also don't like the idea of telling future devs on this project that the way of running this project is "long list of shenanigans that only I understand".
Any help or advice on this would be much appreciated!
Update: I accidentally left my Chromecast pointing directly to my local dev server and managed to recreate the working scenario, which I took a screenshot of. I assume this won't last very long, so here's exactly what I'm talking about. This is possible:

Can't print a flash application within electron

My problem
I am currently developing an electron (v4.2.10, I can't upgrade) application with the primary purpose of browsing on a specific homepage (using electron-navigation) and making their flash games playable.
I have included the Pepper Flashplayer (v32.0.0.156) for this purpose and so far it is all working well.
However when trying to print a page including a flash game it will print a blank page. Trying the same in my current versions of Chrome or Firefox (with current flash player) yields the same result, however in Edge it works.
What I've tried so far
I have no access to the actual pages of the site or any of the swf files
The pages with the swf files are http (I tried setting browserWindow web preference disableWebSecurity to true, no change)
I have tried different versions of the flashplayer
Screenshotting the page is sadly not an option
I have looked into the plugin nw-flash-trust but I am accessing an external source
When I downgraded electron to v3.0 it actually managed to print most of the display, which may point to it being related to the underlying chromium version
Does anyone have an idea how I can fix this? I have absolutely no knowledge of flash development itself. I would love to be able to print on v4.10 too. Many thanks for any help!

Can I embed a chrome extension app as part of my main AngularJS app?

I have been doing a lot of reading and studying to figure out.
I basically just want my main AngularJS application to run, but also include an embedded Chrome Extension app - in this case, have regularly scheduled alarms (using the chrome.alarm API).
I want all users of my AngularJS app to have automatic access to the Chrome extension app, embedded in the main clientside one with lots of other Angular features.
It seems like I have to manually enable my Chrome app in Developer mode on my browser and even drag my Chrome app specifically to a location in my Chrome browser. I don't understand how end users can just automatically use my Chrome app then.
I need to add here I have never really used jQuery, only AngularJS but AngularJS extensively. My AngularJS app is the frontend, the backend is provided by Rails.
Some advice would be really helpful. I hope I am not downvoted as it is strange how sometimes questions get downvoted and I am not sure why...I don't really know where else to go with this question.
EDIT:
Ok some code to demonstrate:
myangularapp.controller('myappcontroller', function($scope, $http) {
var delayvar = 5;
chrome.alarms.create("arandomalarm", {delay: delayvar});
};
This doesn't just work as part of my AngularJS, I tried creating a manifest.json file in the app/assets folder too. As well as a background.js file there and my-chrome-app.js file. "chrome.alarms" is undefined, but I haven't enabled Developer mode yet. But still, how are end users supposed to use it if just to make me use it I need to do so much specific browser configuration?
You should have a look at Content Scripts and then at Message Passing which explains you how to communicate between a web page and an Chrome extension.
its not possible to automatically install a chrome extension. the user must install it from the chrome store.
you may make it easier for them to install it by providing an inline installation from your webpage. its in the official documentation and you can see an example on this page with the "add to chrome" button:
http://plusfortrello.com (one of my chrome extensions which has inline installation inside that page).
that example button is further customized to display a message instead if the user is not on chrome desktop.
if your extension also has permission to your webpage then you can also detect from your webpage if the extension is already install it (to hide the button, send messages to it and such).

How to run a script from the Web in a Windows 8 app?

My organization already developed iOS and Android apps, and is starting to develop an app for Windows 8. In case it matters, the app is using Phonegap a.k.a. Cordova.
On the existing apps, the user downloads a very "slim" app from the store, containing a minimal HTML page. The user logs into a server, and then script tags are dynamically added pointing to locations on that server. Similar to web apps, scripts are downloaded to the client and then executed.
Windows 8's new security model blocks this behavior. Since the app runs in the local context and the script is on the web, I get the error "An app can’t load remote web content in the local context."
Is there a way to get around this restriction?
I'm open to "creative" suggestions and hacks, up to a point. I've already tried a few things, such as fetching a script with plain XHR calls and then injecting the response to a pre-defined script tag. Windows blocked this and all other attempts.
I also considered rendering everything in an iframe with a "ms-appx-web:" scheme (learned about this scheme here, "Schemas and contexts" section). This might allow me to load remote scripts, but would prevent code from accessing APIs of the locally-running JavaScript code -- Cordova and Windows Runtime. This access is necessary for my app. If there's a way to access Cordova and Windows Runtime from the web context, that might be useful too.
I very much doubt it.
The whole point of the MS Windows Store certification model is that they can test your code for malware/ crashes. If you can change the code on the fly, you could ship a perfectly harmless app, have it certified by MS, and then change it to something dreadful after the user installs it.

Categories

Resources