Note that there are some explanatory texts on larger screens.

plurals
  1. POnodejs stops responding after 1 call to S3/SQS
    primarykey
    data
    text
    <p>I am performing a simple process in nodejs/expressjs using the aws-sdk module: </p> <ol> <li>upload file (using browser form post) </li> <li>send it to AWS S3 </li> <li>put a message in AWS SQS for further processing. </li> <li>respond to the client with the SQS return object. </li> </ol> <p>The code below works perfectly, but only one time. After the first post of a file, the node app no longer responds to other posts or actions (it even stops any process I have running with SetInterval(method,10000). When I try to post a second file, it just hangs. If I restart the server it works fine for just one post. I am running nodejs-v0.10.9 inside WebStorm 5 IDE. The code that the client is routed to after the file is posted is below - queueXml:</p> <pre><code>var fs = require('fs'); var step = require('step'); var AWS = require('aws-sdk'); AWS.config.loadFromPath('./lib/aws/config.json'); var bucketName = 'xxxxxx'; var sqsEndPoint = 'http://xxxx'; exports.queueXml = function(req,res){ var key = getGuid(); step( function readPostedFile(){ fs.readFile(req.files.postedfile.path, this); }, function sendToS3(err, data){ if(err) throw err; var s3Bucket = new AWS.S3({params:{Bucket: bucketName}}); var fileData = {Bucket: bucketName, Key: key, Body: data}; s3Bucket.putObject(fileData,this); }, function sendSQSMessage(err, path){ if(err) throw err; var sqs = new AWS.SQS(); var message = {Bucket:bucketName, Key:key}; sqs.sendMessage({QueueUrl:sqsEndPoint,MessageBody:JSON.stringify(message)},this); }, function end(err, data){ if(err) throw err; res.send(JSON.stringify(data)); } ) } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload