Check if site is alive through Heroku - node.js

I`ve build a simple project in nodejs to understand how things works. Everything looks fine on my local server, but when I push this to some cloud(Heroku) I get some strange errors.
The app baseline consist in checking if an address(hostname or ip) is "alive", so I've decided to try some of ping packages on npm(ping and ping-lite). Both of them works properly on my localserver, but when pushed to heroku i got this:
/app/node_modules/ping-lite/ping-lite.js:39
throw new Error('Could not detect '+this._bin+' on your system');
I do not understand a lot of network/tcp-ip stuff, but both of this packages are wrappers for "sys ping" does this mean that I can't use these because heroku does not allow performing a sys ping?
If that is true what I could do to check if an address is alive?
Note: I`m currently doing a http get request to check this, but this do not work with address like (8.8.8.8, dns or public dns) .

Related

FMETP WebGL Unity Build. Emscripten error when FMNetworkManager activated in Heirarchy

So I have been working on a project that streams a video feed from an Oculus quest to a WebGL build running on a remote server (Digital Ocean)
I have two issues currently...
1.When I build to WebGl and push the update online. It will only run if I disable the FMNetworkManager.
If I run the app locally, it has no issues and I have been able to have video sent from the Quest headset to the receiver app.
Part of the response is as follows:
An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:
uncaught exception: abort("To use dlopen, you need to use Emscripten's linking support, see https://github.com/kripken/emscripten/wiki/Linking") at jsStackTrace (Viewer.wasm.framework.unityweb:8:15620)
stackTrace (Viewer.wasm.framework.unityweb:8:15791)
onAbort#https://curtin-cooking-control-nr9un.ondigitalocean.app/Build/UnityLoader.js:4:11199
abort (Viewer.wasm.framework.unityweb:8:500966)
_dlopen (Viewer.wasm.framework.unityweb:8:181966)
#blob:https://***/de128118-3923-4c88-8092-7a9945d90746 line 8 > WebAssembly.instantiate:wasm-function[60882]:0x1413efb (blob:***/de128118-3923-4c88-8092-7a9945d90746 line 8 > WebAssembly.instantiate:wasm-function[62313]:0x1453761)
...
...
...WebAssembly.instantiate:wasm-function[63454]:0x148b9a9)
UnityModule [UnityModule/Module.dynCall_v] (Viewer.wasm.framework.unityweb:8:484391)
browserIterationFunc (Viewer.wasm.framework.unityweb:8:186188)
runIter (Viewer.wasm.framework.unityweb:8:189261)
Browser_mainLoop_runner (Viewer.wasm.framework.unityweb:8:187723)
So I understand there is an issue relating to (wasm) Emscripten and have scoured the internet looking for solutions to no avail.
While I have mentioned I have had video streaming from one device to another. I have only had this functioning locally. With a node.js server also running on Digital Ocean. Which appears to be functioning, seeing both devices being registered by the server at runtime. In each app, while I see what appears to be data transferring by seeing Last Sent Time updating, plus FM Web Socket Network_debug also pushes [connected: True] to a text ui. The IsConnected or Found Server checkboxes inside FM Client (script) fail to check as being connected.
FMNetworkManager
I'm by no means an expert in unity programming, webgl, and webserver setup so my understanding of getting this to function has left me looking at many irrelevant solutions while attempting to make little changes with elements that some solutions suggest with others leaving me blank-eyed looking into space wondering, where do I even implement that.
Any guidance would be great, a step-by-step solution would be fantastic.
[Edit - Detailed Error]
UnityLoader.js:1150 wasm streaming compile failed: TypeError: Could not download wasm module
printErr # UnityLoader.js:1150
Promise.catch (async)
doNativeWasm # 524174d7-d893-4b91-8…0-aa564a23702d:1176
(anonymous) # 524174d7-d893-4b91-8…0-aa564a23702d:1246
(anonymous) # 524174d7-d893-4b91-8…-aa564a23702d:20166
UnityLoader.loadCode.Module # UnityLoader.js:889
script.onload # UnityLoader.js:854
load (async)
loadCode # UnityLoader.js:849
processWasmFrameworkJob # UnityLoader.js:885
job.callback # UnityLoader.js:475
setTimeout (async)
job.complete # UnityLoader.js:490
(anonymous) # UnityLoader.js:951
decompressor.worker.onmessage # UnityLoader.js:89
Thanks in advance
Aaron
You have wrong use in combining FMNetworkUDP and FMWebsocket together.
For WebGL build, UDP is not allowed, which causes the error as expected.
Your websocket ip is reachable, because it's reachable via your IP.
But please try not to expose your server IP in public forum like stackoverflow, which everyone can connect to your server anytime in future.
You should take away FMNetworkManager completely, while keeping only FMWebsocket components for webgl streaming.
You may test it with their Websocket streaming example scene with webgl build.

Chrome run fails in Azure Functions: An attempt was made to access a socket in a way forbidden by its access permissions

I wrote a web bot that uses Selenium framework to crawl. Installed ChromeDriver 72.0.3626.69 and also downloaded Chromium 72.0.3626.121. The app initializes ChromeDriver with this included Chromium binary (and NOT a locally installed Chrome binary). All this perfectly works on my machine locally.
I've been attempting now to port the app to Azure Functions. I wrote a function, tested it, and it works fine locally. But once I publish it to Azure Functions it fails due to about 182 errors of type:
An attempt was made to access a socket in a way forbidden by its
access permissions
I know this happens due to exceeding the TCP connection limits of Azure sandbox, but the only attempt here was to create an instance of ChromeDriver (not even navigate anywhere yet!)
Here is a screenshot of Azure Function call log.
That error appears about 182 times in a row, and that's basically just an attempt to create a browser instance (or ChromeDriver instance, to be precise - can't be sure if that's Chromium or ChromeDriver causing the issue).
The question: Have anyone experienced issues with ChromeDriver/Chromium creating so many (obviously excessive) connections when launching? And what might help to avoid this.
If that's of any help, this is basically a piece of code that crashes on the last line:
ChromeOptions options = new ChromeOptions();
options.BinaryLocation = this.chromePath;
options.AddArgument("no-sandbox");
options.AddArgument("disable-infobars");
options.AddArgument("--disable-extensions");
if (this.headlessMode)
{
options.AddArgument("headless");
}
options.AddUserProfilePreference("profile.default_content_setting_values.images", 2);
Log.LogInformation("Chrome options compiled. Creating ChromeDriverService...");
var driverService = ChromeDriverService.CreateDefaultService(this.driverPath);
driver = new ChromeDriver(driverService, options, timeout);
I believe you are running this function in a Windows Function App which is subject to quite a few limitations as described in this wiki.
But when running on Linux, functions are basically run in a docker container, removing most of these restrictions that windows has. I believe what you are trying should be possible there.
You could either just deploy your function to a Linux Function App or even build a container and use that directly as well.

Atlassian-connect: Error on 'installed' event

I'm trying to run example Jira add-on.
I have created credentials.json file and have run npm i and node app.js.
But I have problems with installed event. Here is nodejs log:
Watching atlassian-connect.json for changes
Add-on server running at http://MacBook-Air.local:3000
Initialized sqlite3 storage adapter
Local tunnel established at https://a277dbdf.ngrok.io/
Check http://127.0.0.1:4040 for tunnel status
Registering add-on...
GET /atlassian-connect.json 200 13.677 ms - 784
Saved tenant details for 608ff294-74b9-3edf-8124-7efae2c16397 to database
{ key: 'my-add-on',
clientKey: '608ff294-74b9-3edf-8124-7efae2c16397',
publicKey: 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCtKxrEBipTMXhRHlv9zcSLR2Y9h5YQgNQ5vpJ40tF9RmuIzByjkKTurCLHFwMAWU6aLQM+H+Z8wAlpL9AVlN5NKrEP8+a3mGFUOj/5nSJ7ZWHjgju0sqUruyEkKLvKuhWkKkd9NqBxogN0hxv7ue5msP5ezwei/nTJXmnmA5qOAQIDAQAB',
sharedSecret: 'LfT9elHM7iHkto5pHr+MnpH0SR1ypunIDoCyt6ugVJ1Q4hWHurG8k5DjVzLcvT2C98DDbiJiA89VNB0e3DiUvQ',
serverVersion: '100075',
pluginsVersion: '1.3.407',
baseUrl: 'https://gleb-olololololo-22.atlassian.net',
productType: 'jira',
description: 'Atlassian JIRA at https://gleb-olololololo-22.atlassian.net ',
eventType: 'installed' }
POST /installed?user_key=admin 204 51.021 ms - -
Failed to register with host https://gleb-olololololo-22%40yopmail.com:gleb-olololololo-22#gleb-olololololo-22.atlassian.net (200)
The add-on host did not respond when we tried to contact it at "https://a277dbdf.ngrok.io/installed" during installation (the attempt timed out). Please try again later or contact the add-on vendor.
{"type":"INSTALL","pingAfter":300,"status":{"done":true,"statusCode":200,"contentType":"application/vnd.atl.plugins.task.install.err+json","errorMessage":"The add-on host did not respond when we tried to contact it at \"https://a277dbdf.ngrok.io/installed\" during installation (the attempt timed out). Please try again later or contact the add-on vendor.","source":"https://a277dbdf.ngrok.io/atlassian-connect.json","name":"https://a277dbdf.ngrok.io/atlassian-connect.json"},"links":{"self":"/rest/plugins/1.0/pending/80928cb9-f64e-42d0-9a7e-a1fe8ba81055","alternate":"/rest/plugins/1.0/tasks/80928cb9-f64e-42d0-9a7e-a1fe8ba81055"},"timestamp":1513692335651,"userKey":"admin","id":"80928cb9-f64e-42d0-9a7e-a1fe8ba81055"}
Add-on not registered; no compatible hosts detected
I have reviewed tons of information in Google, but didn't found an answer.
More details, that can helps you to answer.
It happens suddenly. It worked OK, but about 1 week ago I start to get this error and cannot fix it. So I didn't change anything, just run add-on again, as I did it every day.
If I try to upload add-on manually I got error in terminal
GET / 302 17.224 ms - 0
GET /atlassian-connect.json 200 2.503 ms - 783
Found existing settings for client 608ff294-74b9-3edf-8124-7efae2c16397. Authenticating reinstall request
Authentication verification error: 401 Could not find authentication data on request
POST /installed?user_key=admin 401 22.636 ms - 45
The most possible reason (that I've found in google) is that I have wrong server time. But the time on my local machine is correct (at least for my timezone).
Anyone has any thoughts about this problem?
Thanks!
I kept randomly having this happen to me. It would be working, then run npm start and I would get the error. Since I'm not using a database right now, I simply removed all references to the juggling-sqlite database. This was in package.json, package-lock.json, config.json, and I just removed store.db. That got it working for me. Pretty frustrating that this happens, not sure a better way around it.

Using Google CloudSQL, getting "connect ECONNREFUSED 127.0.0.1:3306"

I'm trying my best to learn Google's Cloud Platform. They have a CloudSQL offering, which I'm learning via this NodeJS tutorial. Everything worked great until I deployed to their appspot server, at which point I got the following error:
connect ECONNREFUSED 127.0.0.1:3306
I've looked all through the NodeJS project and don't see anything in it or the Cloud Console that is referencing localhost or 127.0.0.1. Googling the error hasn't helped thus far. Any ideas?
I couldn't get this thing fixed when running on server but using this files I was able to read/write from local and production, now im using this connection strings in my own app
https://cloud.google.com/appengine/docs/flexible/nodejs/using-cloud-sql
https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/master/appengine/cloudsql
I had a similar issue when deploying the nodejs sample app 2-structured-data
The reason why the error occurred is that the NODE_ENV environment variable was not passed to the config file that is used to check if node should use a socket for connecting to mysql
You can fix it by adding 'NODE_ENV' in the file config.js :
.env([
...
'NODE_ENV'])

What can be done with Heroku H99 error?

Heroku production app (node.js) fails to start with H99 error for 1 hour.
According to documentation this error means 'heroku platform error' and is one of those that can't be fixed by app owner.
What can be done right now? Should I try fixing it somehow (rollback have already been done with no effect)
Just wait and/or email Heroku support
Hi little bit old but since it happen again,
The error definition is there : https://devcenter.heroku.com/articles/error-codes#h99-platform-error
So you can check heroku status here : https://status.heroku.com/

Resources