-
Notifications
You must be signed in to change notification settings - Fork 59
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
why the _store is empty each request #119
Comments
I am also calling request.yar.set('hi', {key: 'hello'}) and getting undefined calling request.yar.get('hi') on the next request. Hapi v 16.1.0. |
Can you both check that the cookie is actually set in the browser ? |
@Marsup thank you very much, it is the cookie setting problem. |
another question, if my configure above is using catbox-redis or redis, after yar.set, why can't i get the value by redis-client. when I enter redis cmd like "keys userId" or "get userId", I got nothing. |
catbox has absolutely nothing to do with yar. |
the meaning of this sentence “If the content is too big to fit, it uses server storage via the hapi plugin cache interface.” is that only when the data size is over cookie size, the server storage will be used. Am I right ? |
hi , it seems that chrome do not allow get and send cookie, i am using vue+axios to handle http. i have google a lot, but not find a solution, do you know how to solve it? |
Please open a new issue instead of reopening this one. Also, better to ask the last question in hapijs/discuss. |
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions. |
hi, sorry to bother you.
just a small question, maybe it's my problem but i can't find out way to solve it.
in each request i call request.yar.set(userId, {token: value}); to store user info, and i can get token value in this request. but, next time request with same api, i can't get userId's token value, i console out request.yar, the _store is empty.
at first i thought it's because of the difference of request.yar.id, so i use the same request.yar.id by customSessionIDGenerator, the yar._store is also empty.
my question is that: in first request i set userId value, how to get userId value in next request.
my manifest is like this:
manifest = {
server: {
port: envKey('port'),
routes: {
cors: true
},
router: {
stripTrailingSlash: true
},
cache: [
{
name: 'redisCache',
engine: require('catbox-redis'),
host: '127.0.0.1',
partition: 'cache',
password: '123456'
}
]
},
register: {
plugins: [
{
plugin: 'yar', // this is for session
options: {
storeBlank: false,
maxCookieSize: 1024,
errorOnCacheNotReady: true,
name: 'session',
cache: {
cache: 'redisCache',
expiresIn: 600*1000,
segment: 'session'
},
cookieOptions: {
password: 'querasdf123456789012345678901234567890qwerasdf',
clearInvalid: true,
ignoreErrors: true,
isSameSite: 'Strict',
isHttpOnly: true,
isSecure: false,
ttl: 120000
},
customSessionIDGenerator: function(){
return "123456";
}
}
}
],
options: {
once: true
}
}
};
The text was updated successfully, but these errors were encountered: