GithubHelp home page GithubHelp logo

remix-redis-session's People

Contributors

dalperin avatar hauptrolle avatar yaameen avatar yadyn 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

Watchers

 avatar  avatar

remix-redis-session's Issues

Error when using expires

Redis expects the expires value to be an integer, however the expiresToSeconds function returns values with a decimal value. As such, we get errors like this:

ReplyError: ERR value is not an integer or out of range
    at parseError (C:\Source\__rp\payments-web\node_modules\redis-parser\lib\parser.js:179:12)
    at parseType (C:\Source\__rp\payments-web\node_modules\redis-parser\lib\parser.js:302:14) {
  command: {
    name: 'set',
    args: [
      'KEY GOES HERE',
      '{ DATA GOES HERE }',
      'EX',
      '1199.999' <-- This is the problem argument
    ]
  }
}

I believe the fix is to simply wrap the return with Math.round.

Fails when `maxAge` is too large

Hi! ๐Ÿ‘‹

Firstly, thanks for your work on this project! ๐Ÿ™‚

When I tried setting a maxAge that is sufficiently large, Redis complains that the expiry duration needs to be in [integer] seconds. I believe the problem is due to the use of floating point numbers. This patch fixed it for me, so it'll be great if you can apply this or similar to the code.

diff --git a/node_modules/remix-redis-session/dist/index.js b/node_modules/remix-redis-session/dist/index.js
index eefa741..a2b73d4 100644
--- a/node_modules/remix-redis-session/dist/index.js
+++ b/node_modules/remix-redis-session/dist/index.js
@@ -25,7 +25,7 @@ const expiresToSeconds = (expires) => {
     const now = new Date();
     const expiresDate = new Date(expires);
     const secondsDelta = (expiresDate.getTime() - now.getTime()) / 1000;
-    return secondsDelta < 0 ? 0 : secondsDelta;
+    return secondsDelta < 0 ? 0 : Math.round(secondsDelta);
 };
 function createRedisSessionStorage({ cookie, options }) {
     let redis;

This issue body was partially generated by patch-package.

Example use? `(0 , sessions_1.createSessionStorage) is not a function` error

I was looking for an equivalent to express-session and connect-redis for Remix and remix-auth. Is that what you're aiming for? If so, would you share a working example?

I tried replacing the createCookieSessionStorage call with createRedisSessionStorage and that doesn't seem to be enough. I'm getting the following error:

/home/xxx/yyy/node_modules/remix-redis-session/dist/index.js:40
    return (0, sessions_1.createSessionStorage)({
                                               ^
TypeError: (0 , sessions_1.createSessionStorage) is not a function
    at createRedisSessionStorage (/home/xxx/yyy/node_modules/remix-redis-session/dist/index.js:40:48)
    at Object.<anonymous> (/home/xxx/yyy/src/remix/app/auth/session.server.ts:9:29)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
    at internal/main/run_main_module.js:17:47

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.