Plans for Express sessions store

+1 For a way to set this up or at least a guide (@JonL that test you’ve done for filesystem store, is that something that can be used with a DigitalOcean droplet?)

Btw to just handle the being logged out issue, just use a remember me options with the login so a cookie is used and next time the user is auto logged in.

Yes as DO has persistent storage.

As I normally use providers without persistent storage I had to go with a Postgres based session store.

@George When I set the ‘remember me’ with the login it indeed makes the cookie BUT when I deploy again it still forces me to log in again.

See video:

Am I understanding you wrong George, or is it a bug?

1 Like

Hello @JonL, making sessions persistent after a server restart sounds great!. Could you share a bit more on how you accomplished this to give it a try?

Thank you!

We already have the possibilities for using Redis as session store.

When you enable Redis - just as for caching, it will be used for session store as well:

Hello George, thank you for the response and the link.

I didn’t realize Redis Caching could help with session store as well.

Just to clarify, by

just as for caching, it will be used for session store as well

Are you referring to the action of -querying the db for a user’s data based on the SecurityProvider identity- being cached by Redis?

Or does “Using Redis as a session store” mean something different.

Best regards.

Hi George, pls correct me if im wrong, but I read that Redis can only be used with Docker, unfortunately I do not use docker in production since my hosting gives me Cpanel with the Nodejs implementation. I hope you can integrate it for those of us who work without docker.

2 Likes

What kind of session store would you prefer, what is possible with your host? Options could be using the file system or an existing database. We could perhaps also support an external redis server.

I saw you have already a half-baked knex and file store.

For now and for future I would always try to make any integration compatible with docker and externally if possible.

I am using a knex based store and I use an external database. Once redis is available externally I will swap from knex to redis. Also for the cache.

I use Docker/AWS and an external to Docker DB - am I reading the above right that the new red is cache feature will not work with this setup?

If you use Wappler’s docker deployment Redis cache should work without problems.

2 Likes

I don’t think I am qualified to weigh in on this, but with the recent HTML to PDF module I created, I found that the Puppeteer package cannot work on my shared hosting. So, a solution that does not require any specific packages to be present on the host, would be best.

Puppeteer is quite memory intensive that is why you probably can’t use it in a shared environment.

It makes it easy to export to pdf but it is a headless browser after all.

Nothing to do with the packages you use for session stores.

In my case, memory was not the issue. The shared hosting environment was missing packages which my hosting provider said they can’t install at this time.

I am not sure I follow. What I was trying to say is whatever approach is taken for session store, just check if it can be run on a shared hosting environment.

That would depend on the provider I guess. Not something Wappler team can anticipate by testing the myriad of shared hosting providers out there.

Did they give you a more detailed answer about why they couldn’t/wouldn’t install the package?

No… They definitely can’t do that. But they can just check on 1 or 2 of them. From my experience, most providers have a similar set of restrictions for shared hosting.

No. I didnt think to ask either. They advised to use a VPS. It could be for memory reasons like you say.

1 Like

Hello, are you using an external database for session storage? If so, could you give us any pointers on hoy to accomplish this?

(I know that Redis can be enabled with Docker, but I would like to explore this idea).

Thanks!

Sure.

You need to use this package:

And overwrite some of the session functionality in the core files. The examples provided by the author are pretty straightforward.

Although I already saw partial code regarding knex session store. Wappler has been working on it but it’s not complete yet. You might want to wait and/or ask them.

1 Like

Awesome! thanks a lot :slightly_smiling_face:

1 Like