Code Monkey home page Code Monkey logo

connect-memcached's People

Contributors

akandels avatar allouis avatar asa1-et-jenkins avatar balor avatar brianloveswords avatar jas- avatar kopertop avatar nfriedly avatar odbol avatar tmont avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

connect-memcached's Issues

Crypto algorithm

Good morning, I see you have merged the latest crypto functionality updates. An apology is warranted, it seems the algorithm for the latest updates in the Readme.md file also needs to change. The default is now aes-256-gcm. The remaining verbiage can be removed as well. Have a good afternoon.

Possible bug in AWS environment

Hi, I'm getting this error:

APP      | 2017-06-28 18:47: Server error: SyntaxError: Unexpected end of JSON input
APP      |     at JSON.parse (<anonymous>)
APP      |     at MemcachedStore.decryptData (/var/myapp/node_modules/connect-memcached/lib/connect-memcached.j s:180:27)
APP      |     at Object.callback (/var/myapp/node_modules/connect-memcached/lib/connect-memcached.js:85:52)
APP      |     at Client.memcached.delegateCallback (/var/myapp/node_modules/memcached/lib/memcached.js:687:12)
APP      |     at Client.rawDataReceived (/var/myapp/node_modules/memcached/lib/memcached.js:758:22)
APP      |     at Client.BufferBuffer (/var/myapp/node_modules/memcached/lib/memcached.js:678:12)
APP      |     at Socket.bowlofcurry (/var/myapp/node_modules/memcached/lib/utils.js:126:15)
APP      |     at emitOne (events.js:115:13)
APP      |     at Socket.emit (events.js:210:7)
APP      |     at addChunk (_stream_readable.js:252:12)
APP      |     at readableAddChunk (_stream_readable.js:235:13)
APP      |     at Socket.Readable.push (_stream_readable.js:197:10)
APP      |     at TCP.onread (net.js:588:20)

I added a console.log to the line 180 of lib/memcached.js and I got this:

APP      | 2017-06-28 18:50: 2323 '{"ct":"c8d2339bb4f7bb0ea299afbebb19ff312cb35b0ff04d5f3beec6d2ddc9108d43ee99cd4fec0c800f769d73fd189ebc4acbacc99b32538bd414acd672638a1de5cc910e97049427e549fcdfdfd7bb33fb14886cc6e2770001ce541fc918392b0665e0dc26427dc22cb7908b14bde65ee873181cf70971adb31bd9efc99ad2e602c464d62ea31a507b2b3c7a5193a0ac09bcfb6cad232d5eff9da5c5b41fee485b77474b8c304c9cbd503825fbab3ab554921b1d69d5313d162996979a7bfae9534bf99efffbbb690f7f549347b89a15339fccaf9b67f337b172c9c23c565df3102b6f4f5df906e648242b3b7c4141ded0ee8e684d225667af141347ac0d884b6ee85ed0554572874a8ac43b66bda63ae6603b5299e73eadc891d9ac722160e1be587e6db602add87f2faeef6c6c4ebb8a132c5bbcfe67758dd8c96fcd4e2dc2ff3d0c9952e0b58e30be75abefca3e7ed14a8650c1b5b70a7b9a4bdaf1452cc68c5e39a204f6e79507b90baeaead2667b2d399c5d1711375688e3a58dc1899c39684f2034ec65e3407aec9d62bbdd8bcc61faa9793c7fe73a09a4592ee0eec740d4b5aaa592ab2519bbb4b18c2580bb0ffafcf9ead8cd711e04c6d3c72132bbd4a11ae5caa0befeac3efe2ef32d48787f969bb05a163d706f1751dd18c714bf26411d7b717e584bf13e5573fd16b5f47345542655f2c7286f5089c4f692'
APP      | 2017-06-28 18:50: Server error: SyntaxError: Unexpected end of JSON input
APP      |     at JSON.parse (<anonymous>)
APP      |     at MemcachedStore.decryptData (/var/myapp/n
(...)

I suppose that this is somehow connected with AWS (Memcache in RDS), when I run my app locally, nothing's wrong.

@balor do you have any idea how to work it around?

Thanks

Passing in a existing memcached client ignores the secret option

I have a project that already has a memcached instance created, yet when adding connect-memcached, it will create a new instance of the client but i wanted to use the existing instance

Took a look at the code and i see i can pass in a client at MemcachedStore(), but for some reason in case a client is passed the secret option is ignored:

function MemcachedStore(options) {
options = options || {};
Store.call(this, options);
this.prefix = options.prefix || "";
this.ttl = options.ttl;
if (!options.client) {
if (!options.hosts) {
options.hosts = "127.0.0.1:11211";
}
if (options.secret) {
(this.crypto = require("crypto")), (this.secret = options.secret);
}
if (options.algorithm) {
this.algorithm = options.algorithm;
}
options.client = new Memcached(options.hosts, options);
}
this.client = options.client;
}

Shouldn't the if (options.secret) block be outside the if (!options.client)?

Confirm memcached connection

If using connect-memcached as session store in nodejs how can one confirm connectivity to memcached has occured?

I am wanting to ensure memcached is up and running and throw error/exception if nodejs application can't connect to memcached.

Thanks

how to set prefix

I want to add a prefix to ensure that keys you set in memcache during the session are unique to my application.

I have tried setting it up as follows but not sure if I am doing it correctly, or how to check.

 store: new MemcachedStore({
    hosts: ['127.0.0.1:11211'],  
    prefix: prefix
 })

here is my full code below:

app.use(session({
    secret: 'CatOnKeyboard', 
    key: 'test',
    proxy: 'true',

    store   : new MemcachedStore({
        hosts: ['127.0.0.1:11211'],  
        prefix: prefix,
        secret: '123, easy as ABC. ABC, easy as 123' // Optionally use transparent encryption for memcache session data
    })
}));

maintenance help

Has this been abandoned? Latest non-readme changes are from May 2014

Care to add some maintainers if help is needed?

Example won't work

I tried to use some of the Example code in my app by making a few changes and it didn't worked. After hours of changing my code and 'adapting' it so that the memcached could work I tried to run just the example to know if I was the one wrong here.

So I copy paste the code, and run it and the same problem I was having with my app happened. When you access the designated URL for your app(example: 127.0.0.1:9341) it will keep loading and loading.

Please if I'm doing something wrong please tell me, otherwise it would be nice if you could fix this problem.

Thank You.

Session cookies issue when upgrading from v1 to v2

When trying to upgrade from v1 to v2 I get the following stacktrace when using the express-session:

TypeError: Cannot read properties of undefined (reading 'expires') (Most recent call first)
at MemcachedStore.Store.createSession (/var/www/app/node_modules/express-session/session/store.js line 87 col 28)
at inflate (/var/www/app/node_modules/express-session/index.js line 372 col 12)
at <unknown> (/var/www/app/node_modules/express-session/index.js line 499 col 10)
at Object.<anonymous> (/var/www/app/node_modules/connect-memcached/lib/connect-memcached.js line 99 col 1)
at exports.AsyncResource.runInAsyncScope (node:async_hooks line 202 col 8)
...

I'm still trying to dig into the details, but the missing session.cookies doesn't look great.
This is for code not using encryption.

session expire

Hi,

i am using your solution to store my web app sessions with express.

Problem is that apparently the sessions expire after 60 seconds.
How do change this?

Thanks in advanced.

No authentication?

Trying to get my app working with redis/memcachedcloud but I cannot find any place in config I could put my login and password details in. Does it mean connect-memcached won't work because it does not support authentication?

memjs has it

and there seems to be a library connect-memjs specially for this purpose.

Shouldn't that security be enabled somehow?

Latest test suite

Good morning,

While trying to run the new test suite I am receiving 500 responses on the any iteration after the initial request.

$ npm install
$ npm test

> connect-memcached@1.0.0 tests /connect-memcached
> NODE_ENV=test jest --testTimeout=10000

FAIL test/test.js
  Plain memcached session store
    GET / should increment views value at each request (92 ms)
    
  Plain memcached session store > GET / should increment views at each request

  expect(received).toEqual(expected) // deep equality

  Expected: 200
  Received: 500

      10 |     for (var i = 1; i < 50; i++) {
      11 |       const res = await serverAgent.get("/");
   > 12 |       expected(res.status).toEqual(200);
                                                    ^

Store fails on memcached 0.0.8

memcached recently updated to 0.0.8. The session store fails to record any entries in memcache on 0.0.8. Reverting to 0.0.7 fixes the issue.

user logout automatically

Hi,

I am using connect-memcached("0.2.0;') and express("3.1.0"). In my web application, there are two interface admin panel and site interface. I am using different session in both cases.

In admin panel, i always send backend = 1 in header.

var app = module.exports = express();

var session = express.session;
var MemcachedStore = require('connect-memcached')(session);
var host = process.env.MEMCACHE_PORT_11211_TCP_ADDR || sessionServer.host || 'localhost';
var port = process.env.MEMCACHE_PORT_11211_TCP_PORT || sessionServer.port || '11211';

var admin_session = session({
    key: 'admin_token',
    secret: 'aersda@#$32sfas2342',
    cookie: {
        maxAge: 30 * 24 * 60 * 60 * 1000,
    },
    store: new MemcachedStore({
        hosts: host + ":" + port
    })
});
var user_session = session({
    key: 'jsessionid',
    secret: 'aersda@#$32sfas2342',
    cookie: {
        maxAge: 30 * 24 * 60 * 60 * 1000,
    },
    store: new MemcachedStore({
        hosts: host + ":" + port
    })
});
app.use(function (req, res, next) {
    console.log("Setting session ");
    if (req.headers.backend == '1') {
        admin_session(req, res, next);
    } else {
        user_session(req, res, next);
    }
});

I am using google cloud instance for memcache.

When user login on my computer, it is working fine but on my client networks, user logout automatically after 10-15 min.

I console the cookies on server, cookies value is changed automatically and user logout. I don't know why it is happening.

How to debug and resolve it.

If I used redis server for session storage, then everything is working fine.

Dependency on "connect"

With npm 1.x / node 0.4.8+ modules are no longer global by default, so package.json should contain all dependencies:

, "dependencies": { "memcached": ">= 0.0.1", "connect": "*" }

to avoid a missing module:

$ npm install connect-memcached
$ node
> require("connect-memcached")
Error: Cannot find module 'connect'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.