angular2 Uncaught SyntaxError when accessing through dns and https - javascript

I have no idea why this problem happens. the site is written in angular2 typescript, and compiling with angular-cli.
when I upload the compiled app to the remote server and accessing the site through static IP or DNS without https all works fine. but when I try to access through the DNS and https which points to the same IP I get a screen with: "loading.." and in the console:
"Uncaught SyntaxError: Invalid or unexpected token" - authentication.service.ts:29 but the service is totally fine.
the app is live at:
https://etype-solutions.com/ or https://81.199.117.250/
versions:
os: ubuntu 16.04 LTS / Windows 10 x64
browser: chrome v55
angular-cli: 1.0.0-beta.26
node: 6.9.4
npm: 3.10.10
typescript: 2.0.10
angular2: 2.3.1

It is redirecting to HTTPS version and the error are saying that it is trying to load HTTP (non secure) resources and that is blocked by the browser due to security issues.
Use //mylink.com instead http://mylink.com or https://mylink.com so you will use the current protocol and avoid this kind of problem.

Related

Expo: How to fix web push notification in development when accessing through localhost (and how to fix the `localhost` service worker)?

I am using Expo SDK Version: 36 to generate a PWA.
curl http://$LOCAL_IP:19006/expo-service-worker.js: OK 200
curl http://localhost:19006/expo-service-worker.js: FAIL => Instead of serving expo-service-worker.js it serve the static asset index.html.
It cause the following error in the console:
Failed to register service-worker DOMException: Failed to register a ServiceWorker for scope ('http://localhost:19006/') with script ('http://localhost:19006/expo-service-worker.js'): The script has an unsupported MIME type ('text/html').
The file expo-service-worker.js is not served and this is problematic when you must implement web push notification because only localhost can work without it when site is not served with HTTPS.
Related issues:
https://github.com/expo/expo-cli/issues/2063
https://github.com/expo/expo-cli/issues/2468
How can I fix it?

ERROR #wdio/runner: Error: Failed to create session. session not created: This version of ChromeDriver only supports Chrome version 83

I'm getting an error 'ERROR #wdio/runner: Error: Failed to create session.
session not created: This version of ChromeDriver only supports Chrome version 83' while running a script in WebdriverIO V6 with Cucumber framework though I'm running in chrome browser (85.0.4183.83) locally and my chromedriver configuration in package.json file is "chromedriver": "^85.0.0".
The only concern here is even If I keep my chromedriver version 85.exe file in my node_modules->.selenium-> chromedriver then It's throwing a same error while running a script.
Is there any workaround to fix this issue?
You have to either set chromedriver version in the selenium standalone config https://webdriver.io/docs/selenium-standalone-service.html#configuration or use https://webdriver.io/docs/docs/wdio-chromedriver-service.html only but not all together.
chromedriver package is not used by selenium-standalone-service
Note: please use chromedriver (not Chrome browser!) version, see https://chromedriver.chromium.org/downloads

Webpack log errors "net::ERR_SSL_PROTOCOL_ERROR" by calling sockjs-node/info

on front I use react on back .net core 3.1
on client I use webpack that is runned on localhost:8080
in Startup.cs I use proxyToSpa
applicationBuilder.UseSpa(spa =>
{
spa.UseProxyToSpaDevelopmentServer("http://localhost:8080/");
});
on HTTP works as expected without any errors but on HTTPS I saw a lot of console errors and failed requests in Network there is failed requests for (sockjs-node/info?t=...) with error net::ERR_SSL_PROTOCOL_ERROR
Is there any options to configure webpack or .net core project to avoid these error logs on HTTPS?
This might be the issue, it worked for me
https://howchoo.com/chrome/stop-chrome-from-automatically-redirecting-https
If you ever visited the https version of a website (whether it resolved or not), Google Chrome might repeatedly send you to that version
https://webpack.js.org/configuration/dev-server/#devserverdisablehostcheck
using cli
webpack-dev-server --disable-host-check
or in webpack config
devServer: {
disableHostCheck: true
}
My main site was using https (reverse proxy to development server), so definining public: http://... didn't help for my development server, because the browser forced https (as the main site was https to).
What helped me was using https in the devServer too:
https://stackoverflow.com/a/29772748/3279070
It was important that devServer HTTPS was signed with a good certificate like the main site was (the reverse proxy) and uses a hostname (public property) signed by the cert. So for example typical scenario is using the same certificate files and the same hostname (public: 'https://hostname:8081') as the main site

Red Screen React Native Reference Error : Can't find variable : _fbBatchedBridge

I followed the steps mentioned in following documents and everything runs perfectly.
https://facebook.github.io/react-native/docs/getting-started.html
https://facebook.github.io/react-native/docs/android-setup.html
https://facebook.github.io/react-native/docs/running-on-device-android.html
Now am trying to run the android app on my device but I get below error.
I tried following to resolve the issue:
react-native start > /dev/null 2>&1 &
adb reverse tcp:8081 tcp:8081
If I try to run without a server, bundle the jsfile into the apk by running:
curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"
I get
I followed all the steps outlined in this question react native android failed to load JS bundle but still I am not able to resolve the issue.
I am using my smartphone's data plan on my OSX machine via hotspot. I entered my machine's IP address inet 192.168.43.14 along with port 8081 in the react-native developer setting.
Any idea what am missing here?
Device details:
OSX El Capitan 10.11.1
Nexus 5(Rooted) 6.0.1
Node - v4.2.1

node js fails to serve mobile clients only

I have a node js server on a docker container runing on digital ocean, that serve an angular 2 application bundeled and traspiled with webpack.
When I try to get the application from any computer it works, but if I try to get it from my android device or ipad it fails to load the js files.
The browsers shows this errors:
Failed to load resource: net::ERR_CONNECTION_REFUSED common.js
Failed to load resource: net::ERR_CONNECTION_REFUSED vendor.js
Failed to load resource: net::ERR_CONNECTION_REFUSED app.js
Again it works on desktop chrome/firefox/safari.
Did you check if you has AdBlock or something similar in your devices? Sometimes it can cause errors like this.
Check too if you are using a proxy in the devices connection.
I hope my answer will be helpfulp!

Categories

Resources