Maximum call stack size exceeded (web socket in node.js)
up vote
0
down vote
favorite
i'm implementing a web socket in nodejs to make a query to dynamodb but appear this error:
buffer.js:398
Buffer.isBuffer = function isBuffer(b) {
^
RangeError: Maximum call stack size exceeded
at Function.isBuffer (buffer.js:398:36)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:44:66)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
.....here is my code:
let app = require('express')();
let http = require('http').Server(app);
let io = require('socket.io')(http);
const AWS = require('aws-sdk');
AWS.config.update( region: 'us-west-2' );
docClient = new AWS.DynamoDB.DocumentClient();
const tableName = 'Dispositivo';
var datos=docClient.scan(
TableName: tableName
,(err, data)=>
if(err)
console.log(err);
else
console.log(data);
);
io.on('connection', (socket) =>
// Log whenever a user connects
console.log('user connected');
// Log whenever a client disconnects from our websocket server
socket.on('disconnect', function()
console.log('user disconnected');
);
// When we receive a 'message' event from our client, print out
// the contents of that message and then echo it back to our client
// using `io.emit()`
socket.on('message', (message) =>
console.log("Message Received: " + message);
io.emit('message', type:'new-message', text: datos);
);
);
// Initialize our websocket server on port 5000
http.listen(5000, () =>
console.log('started on port 5000');
);
node.js amazon-web-services socket.io amazon-dynamodb
add a comment |
up vote
0
down vote
favorite
i'm implementing a web socket in nodejs to make a query to dynamodb but appear this error:
buffer.js:398
Buffer.isBuffer = function isBuffer(b) {
^
RangeError: Maximum call stack size exceeded
at Function.isBuffer (buffer.js:398:36)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:44:66)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
.....here is my code:
let app = require('express')();
let http = require('http').Server(app);
let io = require('socket.io')(http);
const AWS = require('aws-sdk');
AWS.config.update( region: 'us-west-2' );
docClient = new AWS.DynamoDB.DocumentClient();
const tableName = 'Dispositivo';
var datos=docClient.scan(
TableName: tableName
,(err, data)=>
if(err)
console.log(err);
else
console.log(data);
);
io.on('connection', (socket) =>
// Log whenever a user connects
console.log('user connected');
// Log whenever a client disconnects from our websocket server
socket.on('disconnect', function()
console.log('user disconnected');
);
// When we receive a 'message' event from our client, print out
// the contents of that message and then echo it back to our client
// using `io.emit()`
socket.on('message', (message) =>
console.log("Message Received: " + message);
io.emit('message', type:'new-message', text: datos);
);
);
// Initialize our websocket server on port 5000
http.listen(5000, () =>
console.log('started on port 5000');
);
node.js amazon-web-services socket.io amazon-dynamodb
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
i'm implementing a web socket in nodejs to make a query to dynamodb but appear this error:
buffer.js:398
Buffer.isBuffer = function isBuffer(b) {
^
RangeError: Maximum call stack size exceeded
at Function.isBuffer (buffer.js:398:36)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:44:66)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
.....here is my code:
let app = require('express')();
let http = require('http').Server(app);
let io = require('socket.io')(http);
const AWS = require('aws-sdk');
AWS.config.update( region: 'us-west-2' );
docClient = new AWS.DynamoDB.DocumentClient();
const tableName = 'Dispositivo';
var datos=docClient.scan(
TableName: tableName
,(err, data)=>
if(err)
console.log(err);
else
console.log(data);
);
io.on('connection', (socket) =>
// Log whenever a user connects
console.log('user connected');
// Log whenever a client disconnects from our websocket server
socket.on('disconnect', function()
console.log('user disconnected');
);
// When we receive a 'message' event from our client, print out
// the contents of that message and then echo it back to our client
// using `io.emit()`
socket.on('message', (message) =>
console.log("Message Received: " + message);
io.emit('message', type:'new-message', text: datos);
);
);
// Initialize our websocket server on port 5000
http.listen(5000, () =>
console.log('started on port 5000');
);
node.js amazon-web-services socket.io amazon-dynamodb
i'm implementing a web socket in nodejs to make a query to dynamodb but appear this error:
buffer.js:398
Buffer.isBuffer = function isBuffer(b) {
^
RangeError: Maximum call stack size exceeded
at Function.isBuffer (buffer.js:398:36)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:44:66)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
at hasBinary (E:ProyectoSMETAprendiendo_nodejs_y_Angularangular-socket-io-example-masterservernode_moduleshas-binary2index.js:58:59)
.....here is my code:
let app = require('express')();
let http = require('http').Server(app);
let io = require('socket.io')(http);
const AWS = require('aws-sdk');
AWS.config.update( region: 'us-west-2' );
docClient = new AWS.DynamoDB.DocumentClient();
const tableName = 'Dispositivo';
var datos=docClient.scan(
TableName: tableName
,(err, data)=>
if(err)
console.log(err);
else
console.log(data);
);
io.on('connection', (socket) =>
// Log whenever a user connects
console.log('user connected');
// Log whenever a client disconnects from our websocket server
socket.on('disconnect', function()
console.log('user disconnected');
);
// When we receive a 'message' event from our client, print out
// the contents of that message and then echo it back to our client
// using `io.emit()`
socket.on('message', (message) =>
console.log("Message Received: " + message);
io.emit('message', type:'new-message', text: datos);
);
);
// Initialize our websocket server on port 5000
http.listen(5000, () =>
console.log('started on port 5000');
);
node.js amazon-web-services socket.io amazon-dynamodb
node.js amazon-web-services socket.io amazon-dynamodb
edited Dec 8 at 0:51
dmcgrandle
1,347415
1,347415
asked Nov 12 at 2:30
Steven Giraldo
236
236
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
You are trying to emit a function that is stored inside the variable datos
. Since that function is asynchronous you are not actually storing the data that you get inside the callback function. You are console.logging it but you are not storing it on the variable. That's the reason io.emit
fails. I recommend you read on how asynchronous functions work in javascript. Read more about this problem that many new javascript developers have here: How do I return the response from an asynchronous call?
is "docClient.scan()" asynchronous?
– Steven Giraldo
Nov 12 at 21:54
Yes. Here is the link to the documentation: docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/…
– itsundefined
Nov 12 at 21:59
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53255288%2fmaximum-call-stack-size-exceeded-web-socket-in-node-js%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You are trying to emit a function that is stored inside the variable datos
. Since that function is asynchronous you are not actually storing the data that you get inside the callback function. You are console.logging it but you are not storing it on the variable. That's the reason io.emit
fails. I recommend you read on how asynchronous functions work in javascript. Read more about this problem that many new javascript developers have here: How do I return the response from an asynchronous call?
is "docClient.scan()" asynchronous?
– Steven Giraldo
Nov 12 at 21:54
Yes. Here is the link to the documentation: docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/…
– itsundefined
Nov 12 at 21:59
add a comment |
up vote
0
down vote
You are trying to emit a function that is stored inside the variable datos
. Since that function is asynchronous you are not actually storing the data that you get inside the callback function. You are console.logging it but you are not storing it on the variable. That's the reason io.emit
fails. I recommend you read on how asynchronous functions work in javascript. Read more about this problem that many new javascript developers have here: How do I return the response from an asynchronous call?
is "docClient.scan()" asynchronous?
– Steven Giraldo
Nov 12 at 21:54
Yes. Here is the link to the documentation: docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/…
– itsundefined
Nov 12 at 21:59
add a comment |
up vote
0
down vote
up vote
0
down vote
You are trying to emit a function that is stored inside the variable datos
. Since that function is asynchronous you are not actually storing the data that you get inside the callback function. You are console.logging it but you are not storing it on the variable. That's the reason io.emit
fails. I recommend you read on how asynchronous functions work in javascript. Read more about this problem that many new javascript developers have here: How do I return the response from an asynchronous call?
You are trying to emit a function that is stored inside the variable datos
. Since that function is asynchronous you are not actually storing the data that you get inside the callback function. You are console.logging it but you are not storing it on the variable. That's the reason io.emit
fails. I recommend you read on how asynchronous functions work in javascript. Read more about this problem that many new javascript developers have here: How do I return the response from an asynchronous call?
answered Nov 12 at 19:55
itsundefined
8312521
8312521
is "docClient.scan()" asynchronous?
– Steven Giraldo
Nov 12 at 21:54
Yes. Here is the link to the documentation: docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/…
– itsundefined
Nov 12 at 21:59
add a comment |
is "docClient.scan()" asynchronous?
– Steven Giraldo
Nov 12 at 21:54
Yes. Here is the link to the documentation: docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/…
– itsundefined
Nov 12 at 21:59
is "docClient.scan()" asynchronous?
– Steven Giraldo
Nov 12 at 21:54
is "docClient.scan()" asynchronous?
– Steven Giraldo
Nov 12 at 21:54
Yes. Here is the link to the documentation: docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/…
– itsundefined
Nov 12 at 21:59
Yes. Here is the link to the documentation: docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/…
– itsundefined
Nov 12 at 21:59
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53255288%2fmaximum-call-stack-size-exceeded-web-socket-in-node-js%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown