Answered by:
node.js express session stored on azure cache.

Question
-
We are trying to store node.js express sessions on Azure caching.
We already set up a dedicated caching on a worker role following this article http://blogs.msdn.com/b/silverlining/archive/2013/01/03/november-updates-to-windows-azure-powershell-cmdlets.aspx
Add-AzureCacheWorkerRole mycacherole
Enable-AzureMemcacheRole mywebrole mycacheroleIn the sample, they use mc module http://overclocked.com/mc/
I am not sure how to stored express session on azure cache using that module. So if you can enlighten me on that it would be great.
We tried connect-memcached https://github.com/balor/connect-memcached as AzureCache:
MemcachedStore = require('connect-memcached')(express);
app.use(express.session({
secret: 'CatOnTheKeyboard',
store: new MemcachedStore
}));We got error with this trace. So is it possible to get express to store it sessions on azureCache? Thank for your help.
TypeError: Cannot call method 'reverse' of null
at Client.connect
(E:\approot\node_modules\connect-memcached\node_modules\memcached\lib\memcached.js:129:42)
at Client.memcachedCommand [as command]
(E:\approot\node_modules\connect-memcached\node_modules\memcached\lib\memcached.js:299:10)
at Client.get
(E:\approot\node_modules\connect-memcached\node_modules\memcached\lib\memcached.js:794:10)
at MemcachedStore.get
(E:\approot\node_modules\connect-memcached\lib\connect-memcached.js:82:19)
at Object.session [as handle]
(E:\approot\node_modules\connect\lib\middleware\session.js:309:11)
at next (E:\approot\node_modules\connect\lib\proto.js:190:15)
at Object.cookieParser [as handle]
(E:\approot\node_modules\connect\lib\middleware\cookieParser.js:60:5)
at next (E:\approot\node_modules\connect\lib\proto.js:190:15)
at Object.handle
(E:\approot\node_modules\express-validator\lib\express_validator.js:148:10)
at next (E:\approot\node_modules\connect\lib\proto.js:190:15)- Changed type Will ShaoMicrosoft employee Wednesday, August 21, 2013 1:29 AM
Thursday, August 15, 2013 10:43 AM
Answers
-
Hi Elveryx,
Thanks for posting!
From your error message, I think you may need to create or implementing reverse Proxy in your project. This link (https://github.com/simongdavies/NodeCacheExample &&https://github.com/WindowsAzure/azure-sdk-tools/issues/274 ) support a sample, you can download this and try it.
And this link also support a tutorials, I think you can follow this step to achieve to:http://fabriccontroller.net/blog/posts/improve-performance-of-your-node-js-web-site-with-windows-azure-caching-dedicated-role/
Thanks
Will
MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help.- Edited by Will ShaoMicrosoft employee Monday, August 19, 2013 5:16 AM
- Marked as answer by Will ShaoMicrosoft employee Friday, August 23, 2013 2:57 AM
Friday, August 16, 2013 8:47 AM
All replies
-
Hi Elveryx,
Thanks for posting!
From your error message, I think you may need to create or implementing reverse Proxy in your project. This link (https://github.com/simongdavies/NodeCacheExample &&https://github.com/WindowsAzure/azure-sdk-tools/issues/274 ) support a sample, you can download this and try it.
And this link also support a tutorials, I think you can follow this step to achieve to:http://fabriccontroller.net/blog/posts/improve-performance-of-your-node-js-web-site-with-windows-azure-caching-dedicated-role/
Thanks
Will
MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help.- Edited by Will ShaoMicrosoft employee Monday, August 19, 2013 5:16 AM
- Marked as answer by Will ShaoMicrosoft employee Friday, August 23, 2013 2:57 AM
Friday, August 16, 2013 8:47 AM -
Hi Elveryx,
I think you may be miss something to lead to this error.you may need some sample to learn more :
Please try this sample: NodeCacheExample
Thanks!Friday, August 16, 2013 9:56 AM