Giter Site home page Giter Site logo

Comments (13)

vvo avatar vvo commented on May 9, 2024

Hey @prantadutta, what does sameSite: "none" as "none", means? Why not just "none"?

Also is teems sameSite: none is only compatible with secure cookies (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite)

Can you create a repository reproducing your issue? With the smallest amount of context/code as possible.

Then share it and we can work on it.

from iron-session.

theprantadutta avatar theprantadutta commented on May 9, 2024

Hey @prantadutta, what does sameSite: "none" as "none", means? Why not just "none"?

I am using typescript and for some reason, it doesn't accept just "none". The same applies to "strict" and "lax" too.

from iron-session.

theprantadutta avatar theprantadutta commented on May 9, 2024

Also is teems sameSite: none is only compatible with secure cookies (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite)

Okay, But I am on localhost. So how do I use "none" now.

from iron-session.

vvo avatar vvo commented on May 9, 2024

Okay, But I am on localhost. So how do I use "none" now.

I have no idea, sorry. It says you can't use samesite none if cookie is not secure, never tried it though.

"write after end" usually means there's some res.write call being made after the response was already sent. But why is it working on sameSite not none, no idea.

You can get an https website locally: https://dev.to/rhymes/really-easy-way-to-use-https-on-localhost-341m

good luck!

from iron-session.

theprantadutta avatar theprantadutta commented on May 9, 2024

Thanks, maybe I have to go deeper...Although checkout that typescript "none" issue.

from iron-session.

theprantadutta avatar theprantadutta commented on May 9, 2024

Sorry, I had to re-open this issue. It turned this problem still exists in https.
My config:

   export const NEXT_IRON_SESSION_CONFIG = {
      cookieName: "grayscale",
      cookieOptions: {
        httpOnly: true,
        secure: isProduction,
        sameSite: "strict" as "strict",
        // sameSite: "none" as "none",
        maxAge: 60 * 60, // 2 hours
        path: "/",
      },
      password: process.env.APPLICATION_SECRET!,
    };

And this api is giving me the error.

    export default handler.post(async (req, res) => {
      const { data } = req.body;
    
      await applySession(req, res, NEXT_IRON_SESSION_CONFIG);
    
      if (data) {
        (req as any).session.set("user", data);
      } else {
        (req as any).session.unset("user");
      }
      await (req as any).session.save();
      res.end();
    });

I am really lost right now...

from iron-session.

theprantadutta avatar theprantadutta commented on May 9, 2024

@vvo hello, r u there?

from iron-session.

vvo avatar vvo commented on May 9, 2024

@prantadutta Please create a GitHub repository where I can run npm install && npm run dev.

This GitHub repository should be the next-iron-session example (https://github.com/vvo/next-iron-session/tree/master/examples/next.js) with as few changes as possible to consistently reproduce your issue.

By doing so, you might see a time where this issue starts to trigger (maybe when adding some modules).

Once I can reproduce your issue we can see what's wrong maybe.

Thanks.

from iron-session.

theprantadutta avatar theprantadutta commented on May 9, 2024

@vvo The GitHub example is working as expected. Maybe I need to change my code somewhere.

from iron-session.

theprantadutta avatar theprantadutta commented on May 9, 2024

@vvo I can't really figure out what's the problem here...So here's the github repo of my project. It would be really helpful if you take a look.

Also, when I am in HTTPS, I can't really use the API at all. It throws me the unhandled error. But when I am on HTTP, I can use the API with my original cookie options.

from iron-session.

theprantadutta avatar theprantadutta commented on May 9, 2024

hi @vvo did you take a look? what am I doing wrong? it's still crashing my server again and again...please reply..

from iron-session.

vvo avatar vvo commented on May 9, 2024

Hey, @prantadutta I can't test your GitHub repository because it contains too much "noise" (differences with the basic example of next-iron-session). This would take me way too long to figure it out.

As you said, it's working with the GitHub example so most probably there's an issue somewhere with your local certificates and/or code. You can try to removing bits by bits code from your GitHub repo and see when it works, this way you'll get the minimum reproducible code to showcase your bug, which will help you no matter what.

I suggest you use StackOverflow for this kind of help and wish you good luck.

Hope you understand my position here.

from iron-session.

vvo avatar vvo commented on May 9, 2024

closing for inactivity

from iron-session.

Related Issues (20)

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.