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

Not getting Session #5

Closed
akashpius opened this issue Apr 25, 2017 · 3 comments
Closed

Not getting Session #5

akashpius opened this issue Apr 25, 2017 · 3 comments

Comments

@akashpius
Copy link

Hi,
I am developing an application which have both laravel and node app. I need to get laravel session in my node app. So I thought of using your module. But I am not getting the session when i debugged i am getting an error as follows:

0|index | You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
0|index | SyntaxError: Unknown / Unhandled data type(s): =
0|index | at error (/var/www/html/moments.digitaljeevi.com/node_modules/php-unserialize/php-unserialize.js:54:13)
0|index | at _unserialize (/var/www/html/moments.digitaljeevi.com/node_modules/php-unserialize/php-unserialize.js:166:11)
0|index | at unserialize (/var/www/html/moments.digitaljeevi.com/node_modules/php-unserialize/php-unserialize.js:173:10)
0|index | at Object.module.exports.getSessionKey (/var/www/html/moments.digitaljeevi.com/node_modules/node-laravel-session/index.js:48:16)
0|index | at /var/www/html/moments.digitaljeevi.com/helpers/data.js:28:52
0|index | at propagateAslWrapper (/usr/local/lib/node_modules/pm2/node_modules/async-listener/index.js:457:23)
0|index | at /usr/local/lib/node_modules/pm2/node_modules/async-listener/index.js:494:70

Is there any thing I am missing. I am writing my code here. Please help me in solving this issue.

use strict';
var config = require('config');
const cookie = require('cookie');
const laravelSession = require('node-laravel-session');
let redis = require('redis');
let redisCon = redis.createClient();
const ENV_PATH = config.get('API.core.env');
module.exports = {
getCustomerSession: function (request) {
laravelSession.getAppKey(ENV_PATH)
.then((appKey) => {
let session = cookie.parse(request.headers.cookie);
let sessionId = laravelSession.getSessionKey(session.laravel_session, appKey);
console.log(sessionId);
laravelSession.getSessionFromRedis(sessionId, redisCon).then((session) => {
console.log(JSON.stringify(session));
return JSON.stringify(session);
});
});
}
};

Here when i console first session variable i am getting a value as follows:

{ 'XSRF-TOKEN': 'eyJpdiI6IjNUdDcwblwvNUQwVk9FaGQ3VXNUenV3PT0iLCJ2YWx1ZSI6ImVYSEpGK3h6RHZcL2JnZHEySnBcL2hxRmd0M0g3bkxlbkU4MWFwcHJJc3ZybGNOTzVvK1hGRStEeXFZcVhYeDdhdkpsaTQzZmlsNU4yd3ZrcHRsYTNsWUE9PSIsIm1hYyI6ImJmZTUzOTdmNDZjNjgxZTM2ODUyNjYzMWFjOTdiNDBiMTJjMzIzNjQyOTgyOTdjYmM1Yzc5NzczYjdmMzQ0NDYifQ==',
laravel_session: 'eyJpdiI6IndBUFVuU1ZFS0ZwUlJwS1pFSkxWd2c9PSIsInZhbHVlIjoiNzdoWVJzYXBXZlF1MWV0Q1pwbGRod3dFUWF5aEVZbmRibis0UXpnbDRcLzJwcWNJMjVpajFIVTA1WWE5cll3bUZCaGR2VUJxa3B6cVk1a3hzQzlCeWRRPT0iLCJtYWMiOiIyMTU5NWE5YWE0NjhiODc1MzlkYjVmNWNlNTRjYzc4OTIxMWY0MDU0N2UwMjU3MTFiODBjZTc0YmI0MjhhMGM3In0=' }

But after this no variable is returning any value. Please help me.

@spearmootz
Copy link
Owner

spearmootz commented Apr 25, 2017 via email

@spearmootz
Copy link
Owner

let me know if this resolved?

@spearmootz
Copy link
Owner

spearmootz commented May 3, 2017

try updating to version 1.0.10, someone found a bug which i think might be related to this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants