Search code examples
node.jsamazon-web-servicesmeteoramazon-ec2remote-debugging

Meteor server side remote debugging


Versions

I'm using Meteor 1.0.3 and node 0.10.35 on a small Ubuntu Server 14.04 LTS (HVM), SSD Volume Type - ami-3d50120d EC2 instance.

Context

I know how to do server side debugging on my development box, just $ meteor debug and open another browser pointing to the url it produces -- works great.

But now, I'm getting a server error on my EC2 instance I'm not getting in development. So I'd like to set up a remote debug session sever side.

Also, I deployed to the EC2 instance using the Meteor-up package (mup).


EDIT

In an effort to provide more background (and context) around my issue I'm adding the following:

What I'm trying to do is, on my EC2 instance, create a new pdf in a location such as:

application-name/server/.files/user/user-name/pdf-file.pdf

On my OSX development box, the process works fine.

When I deploy to EC2, and try out this process, it doesn't work. The directory:

/user-name/

for the user is never created for some reason.

I'd like to debug in order to figure out why I can't create the directory.

The code to create the directory that works on my development box is like so:

server.js

Meteor.methods({
  checkUserFileDir: function () {
    var fs = Npm.require('fs');
    var dir = process.env.PWD + '/server/.files/users/' + this.userId + '/';
    try {
      fs.mkdirSync(dir);
    } catch (e) {
      if (e.code != 'EEXIST') throw e;
    }
  }
});

I ssh'd into the EC2 instance to make sure the path

/server/.files/user/

exists, because this portion of the path is neccessary in order for the above code to work correctly. I checked the path after the code should have ran, and the

/user-name/

portion of the path is not being created.


Question

How can I debug remote server side code in a easy way on my EC2 instance, like I do on my local development box?


Solution

  • It seems in my case, since I'm using Meteor-up (mup), I can not debug per-say, but get access to the remote EC2 instance server console and errors by using command $ mup logs -f on my development box.

    This effectively solves my issue with being blind on the server side remote instance.

    It still falls short of actual debugging remotely, which speeds up the process of finding errors and performance bottlenecks, but it's all we have for now.