I had an app deployed on Meteor's servers and it worked as expected.
Now, I've moved the app to a NodeJS platform, called Modulus, using their CLI tool. (App hosted at http://crazygain.com)
For some reason, the method calls - Meteor.call or Meteor.apply - are not executed. Looking at the network indicator in Chrome Dev Tools I saw that the request is never sent.
I tried sending requests directly from the console, and got the same result.
e.g. when I execute the following
Meteor.call("foo",function(){console.log("callback");});
on the new Modulus server I simply get undefined
However, when I run it on the old Meteor server I get the "callback" log as expected.
I'm quite puzzled and unsure what can cause such behaviour.
UPDATE:
meteor.status() returns
Object {status: "connected", connected: true, retryCount: 0}
This might be because the web socket connection isn't established. Meteor calls & subscriptions depend on the DDP protocol which have a separate connection to the server.
Have a look at Meteor.status() to see if you are connected & if not investigate your connection's web socket/long polling connection.
It might just be a connection issue. Your meteor call works for me with the site you have provided.
Have you followed the Meteor deployment guide on Modulus' website? You need to convert the app using demeteorizer.
Related
I want to practice creating my own RESTful API service to go along with a client-side application that I've created. My plan is to use Node and Express to create a server. On my local machine, I know how to set up a local server, but I would like to be able to host my application (client and server) online as part of my portfolio.
The data that my client application would send to the server would not be significant in size, so there wouldn't be a need for a database. It would be sufficient to just have my server save received data dynamically in an array, and I wouldn't care about having that data persist if the user exits the webpage.
Is it possible to use a service like Netlify in order to host both a client and server for my purposes? I'm picturing something similar to how I can start up a local dev server on my computer so that the front-end can interface with it. Except now I want everything hosted online for others to view. I plan to create the Express server in the same repo as the front-end code.
No, Netlify doesn't allow you to run a server or backend. However, they do allow you to run serverless functions in the cloud. These can run for up to 10 sec. at a time. Furthermore Netlify also have a BETA solution called "background functions" That can run for up to 15 minutes. But honestly for a RESTful API there sure would be better solutions out there?
If you are still looking for the Netlify for Backend you can consider Qovery. They explained here why it is a good fit for their users.
I have deployed a node js web application on app service in azure. Issue is that my application occasionally getting killed for unknown reason. I have done exhaustive search through all the log fines using kudu.
If I restart app service, application starts working.
Is there any way I can restart my node application once it has crashed. Kind of run for ever no matter what. For example if any error happens in an asp.net code deployed in IIS, IIS never crashes, its keeps of serving other incoming request.
Something like using forever/pm2 in azure app service.
node.js in Azure App Services is powered by IISNode, which takes care of everything you described, including monitoring your process for failures and restarting it.
Consider the following POC:
var http = require('http');
http.createServer(function (req, res) {
if (req.url == '/bad') {
throw 'bad';
}
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('bye');
}).listen(process.env.PORT || 1337);
If I host this in a Web App and issue the following sequence of requests:
GET /
GET /bad
GET /
Then the first will yield HTTP 200, the second will throw on the server and yield HTTP 500, and the third will yield HTTP 200 without me having to do anything. IISNode will just detect the crash and restart the process.
So you shouldn't need PM2 or similar solution because this is built in with App Services. However, if you really want to, they now have App Services Preview on Linux, which is powered by PM2 and lets you configure PM2. More on this here. But again you get this out of the box already.
Another thing to consider is Always On setting which is on by default:
By default, web apps are unloaded if they are idle for some period of time. This lets the system conserve resources. In Basic or Standard mode, you can enable Always On to keep the app loaded all the time. If your app runs continuous web jobs, you should enable Always On, or the web jobs may not run reliably.
This is another possible root cause for your issue and the solution is to disable Always On for your Web App (see the link above).
I really want to thank itaysk for your support for this issue.
Issue was not what I was suspecting. Actually the node server was getting restarted on failure correctly.
There was a different issue. Why my website was getting non responsive is for a different reason. Here is what was happening-
We have used rethinkdbdash to connect to rethinkdb database and we was using connection pool. There was a coding/design issue. We have around 15 change feeds implemented with along with socket.io. And the change feed was getting initialised for every user logged in. This was increasing number of active connections in the pool. And rethinkdbdash has default limit of 1000 connection in the pool and as there were lots of live connections, all the available connection in the pool was getting exhausted resulting no more available connection. So, request was waiting for an open connection and it was not getting any available, hence waiting for ever blocking any new requests to be served.
We develop in the context of the SMARNET01 Firebase Project, an app which uses Firebase Database and Authentication. We use it for developing a Windows 7 with NodeJS 4.5 machine. All is working normally using both API key and later, serviceAccountCredentials because we have to call verifyIdToken.
So when we deploy this in a Docker(which got from DockerHub official NodeJS site) the API key is working, but the serviceAccountCredentials doesn´t. The curious thing is that it is working in the Ubuntu 14.04 VM which contains the docker.
At a different Ubuntu 14.04 VM we raised for this purpose, wasn't able to make it work, neither in the VM nor in the Docker. We tried using different versions of NodeJS(v0.10.25, v0.10.46 & v4.5).
After some digging in the SDK code, we discovered a promise which is not resolved due to a REST call to Google which is never answered (it dies for time out long time after). The call is located in the method CertCredential.prototype.getAccessToken in the credentials.js of the auth-node folder of the SDK.
I tried this call with the Insomnia REST client and it works. We tried different ways to fix that, for instance, check that NTP is synchronized, and checked different suggestions in the internet.
When it stops, the Firebase log stops in:
p:0: Browser went online.
p:0: Making a connection attempt
When it works the logging continuos in this way:
p:0: Browser went online.
p:0: Making a connection attempt
p:0: Auth token refreshed
getToken() completed. Creating connection.
c:0:0: Connection created
c:0:0:0 Websocket connecting to wss://smarnet01.firebaseio.com/.ws?v=5
c:0:0:0 Websocket connected.
c:0:0: Reset packet received. New host: s-usc1c-nss-135.firebaseio.com
...............
Does anyone have any idea what is happening? Thanks in advance.
Connecting to Azure Redis Cache like this, on Owin application startup...
var options = ConfigurationOptions.Parse(cacheConnectionString);
var kernel = new StandardKernel();
kernel.Bind<ConnectionMultiplexer>().ToMethod(context =>
{
return ConnectionMultiplexer.Connect(options);
}).InSingletonScope();
Which works absolutely fine for Redis running on my local machine, or for Azure Redis with SSL turned off. However, as soon as I change the connection string from:
xyz.redis.cache.windows.net,ssl=false,password=abcdefghxyz=
to
xyz.redis.cache.windows.net,ssl=true,password=abcdefghxyz=
It throws:
It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail. UnableToResolvePhysicalConnection on PING
I'm using StackExchange.Redis version 1.0.316.0 from NuGet. I've tried...
Creating different caches in Azure Portal. Hasn't worked over SSL with any of them :(
Connecting without using Ninject
Creating the ConfigurationOptions object manually rather than parsing a string
I'm all out of ideas for what could possibly be going wrong now though. Hopefully it's something trivial I've missed, but just can't see it!
Edit
I ran the ConnectToAzure() unit test, passing in my cache name and password and it passed. So I'm almost certainly doing something silly here.
Edit 2
It also works from a console application without any issues.
I fixed it, super-weird situation but I'll answer just in case someone else is ever sat equally as confused as I've been.
The project was previously a web role in an Azure Cloud Service, which had In-role caching enabled. We moved it to a standalone Azure Web App, but never got around to removing all the unnecessary references that were left over.
Removing Microsoft.WindowsAzure.ServiceRuntime and Microsoft.WindowsAzure.Diagnostics miraculously got it working.
Hi I've been struggling with this issue for a few days now. I have a simple node.js app that connects to Twitter's streaming API and tracks a few terms. As a term is found the client side gets a websocket notification. I've made sure that my OAuth credentials are only used by this app and that the connection to the streaming API occurs only on app start up. What keeps happening is I get a 200 ok response but the stream then disconnects. I have it set to reconnect in 30 seconds but it's becoming ridiculous. It seems to be fine for a few minutes after restarting the app and then goes back to repeatedly disconnecting. The error is {"disconnect":{"code":7,"stream_name":"XXXXX-statuses158325","reason":"admin logout"}}. I have ran the same app locally with multiple client connections and not had a problem. I looked into other hosting services but I can't find one that supports websockets without having to revert to a slow long polling option on socket.io (which won't work for my app's purposes).
Any ideas for why this keeps happening?
that error means that you're connecting again with the same credentials (https://dev.twitter.com/discussions/11251).
One cause might be running more than 1 drone.
If this doesn't help, join us on http://webchat.jit.su and we'll do our best to help you :D
-yawnt