Skip to content
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

Using session when disable_cookies is enabled should tank #1911

Open
jwoertink opened this issue Aug 29, 2024 · 0 comments
Open

Using session when disable_cookies is enabled should tank #1911

jwoertink opened this issue Aug 29, 2024 · 0 comments

Comments

@jwoertink
Copy link
Member

Working out a weird issue with @snadon where session just wouldn't save. The flow that was being used was

  • Land on page
  • Make back-end API call
  • Save data to session
  • Refresh page
  • Expect to see session data loaded, but no session was stored.

This was happening because in a default Lucky app, we disable cookies for the API

https://github.com/luckyframework/lucky_cli/blob/ca11a9fbe37b1130c9ab20c555509da66adab966/src/web_app_skeleton/src/actions/api_action.cr.ecr#L5

Now, what would be neat is if you have disable_cookies and then you call session.set if we could raise an error saying this won't work because cookies are disabled. A compile-time error would be best, but I don't think we'd be able to do that here, so just a runtime exception should be ok.

A few things to consider...

  • What if you're not using cookie store for sessions?
  • What if you have disable_cookies for one action, but not another (as in you call session.set under an action that it's allowed...)?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant