Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error code PROTOCOL_INCORRECT_PACKET_SEQUENCE #1249

Closed
jrivera294 opened this issue Oct 20, 2015 · 5 comments
Closed

Error code PROTOCOL_INCORRECT_PACKET_SEQUENCE #1249

jrivera294 opened this issue Oct 20, 2015 · 5 comments
Assignees
Labels

Comments

@jrivera294
Copy link

Hi everyone.

I'm having difficulties implementing a simple query on a AWS Lambda NodeJS (with JAWS framework). Running it on local it works, but when I upload it to AWS and then try to run it using the API Gateway endpoint, I got this error:

{
  "code": "PROTOCOL_INCORRECT_PACKET_SEQUENCE",
  "fatal": true
}

I can't find any response on google, stackoverflow or issues on git about this error. And I can't figure out what I'm doing wrong.

This is what I'm trying.

var mysql = require('mysql');

var connection = mysql.createConnection({
  host   : '', 
  user   : '', 
  password : '', 
  database : ''
});

function getLists (client_id,api_key,callback){
    connection.query("SELECT * FROM list WHERE client_id = ?",
        [ client_id],function(error, results){
            connection.end();
            callback(error,results);
        }
    );
};

module.exports.run = function(event, context, cb) {
    getLists(event.x_mail_list_client_id,'',function(error,results){
        if(error){
            return cb(null,error);
        }
        return cb(null,results);
    });
};
@dougwilson
Copy link
Member

It could possibly be a bug here or some kind of incompatibility with that server. Can you add debug: true to your options, then paste out the full output provided from start to when you get that error?

@jrivera294
Copy link
Author

Yes, probably it's an incompatibility with the server.

I'm thinking that the logging tool of AWS Lambda isn't the best. On my local environment I get the entire output of the mysql library debug mode. But the AWS lambda log on the server only throw this:

START RequestId: 52035b31-7826-11e5-a20d-ff9a485b383d Version: $LATEST
2015-10-21T19:02:48.477Z    52035b31-7826-11e5-a20d-ff9a485b383d    Received event:
2015-10-21T19:02:48.477Z    52035b31-7826-11e5-a20d-ff9a485b383d    {}
2015-10-21T19:02:48.630Z    52035b31-7826-11e5-a20d-ff9a485b383d    <-- t
2015-10-21T19:02:48.630Z    52035b31-7826-11e5-a20d-ff9a485b383d    { protocolVersion: 10,
  serverVersion: '5.5.44-0ubuntu0.14.04.1',
  threadId: 2283,
  scrambleBuff1: <Buffer 76 69 2b 39 79 7a 77 65>,
  filler1: <Buffer 00>,
  serverCapabilities1: 63487,
  serverLanguage: 8,
  serverStatus: 2,
  serverCapabilities2: 32783,
  scrambleLength: 21,
  filler2: <Buffer 00 00 00 00 00 00 00 00 00 00>,
  scrambleBuff2: <Buffer 74 39 5b 41 71 39 66 76 3e 6e 34 56>,
  filler3: <Buffer 00>,
  pluginData: 'mysql_native_password',
  protocol41: true }
2015-10-21T19:02:48.631Z    52035b31-7826-11e5-a20d-ff9a485b383d    
END RequestId: 52035b31-7826-11e5-a20d-ff9a485b383d
REPORT RequestId: 52035b31-7826-11e5-a20d-ff9a485b383d  Duration: 156.21 ms Billed Duration: 200 ms     Memory Size: 1024 MB    Max Memory Used: 13 MB

I think that it will not help too much, I can't figure out how to get the entire debug log with this tool.

Any ideas?

@dougwilson
Copy link
Member

Unfortunately I have never used those systems, so don't have any tips for how to get the logs. Please keep me posted with the full logs when you can get them. If you cannot figure out how to get them, then if you can debug the code, you could potentially just send a PR to address the issue as an alternative :)

@ghost
Copy link

ghost commented Oct 25, 2015

I was also having this error, it resulted from not excluding the node-mysql module from the browserify builder step. Edit the awsm.json of the lambda to exclude mysql, and then put the path to the node-mysql module in the includePath.

@jrivera294
Copy link
Author

@jewella you are right it worked. I read that this plugin have problem with the browserify library, but I could not find the way to exclude it correctly. Thank you very much.

@dougwilson dougwilson self-assigned this Oct 27, 2015
@mysqljs mysqljs locked and limited conversation to collaborators Oct 27, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

2 participants