Comments (13)
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.
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.
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.
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.
Thanks, maybe I have to go deeper...Although checkout that typescript "none" issue.
from iron-session.
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.
@vvo hello, r u there?
from iron-session.
@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.
@vvo The GitHub example is working as expected. Maybe I need to change my code somewhere.
from iron-session.
@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.
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.
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.
closing for inactivity
from iron-session.
Related Issues (20)
- Package causing multiple response problem HOT 1
- v8 beta release, last tasks and discussions HOT 6
- session object empty on Apollo Server API Route
- Can i use iron-session with pages routes ? HOT 1
- Implementing iron-session with TRPC HOT 9
- Session cookie not created when static web app is sitting behind azure front door due to domain mismatch HOT 3
- Static maxAge
- v8 - Attaching session to request HOT 1
- Make properties in T for IronSession<T> optional (union with undefined)
- v6 and Next 13 pages middleware HOT 7
- Migration away from `withIronSessionApiRoute` HOT 3
- await session.save() fails to set cookie if cookies.set() is used after HOT 2
- session returned from `getIronSessionFromCookieStore` does not implement full interface HOT 1
- outdated dependency @types/cookie causes type mismatch HOT 1
- why getIronSession not work in middleware like in example (App router + client components, route handlers, and SWR) HOT 3
- Support the `partitioned` attribute in cookie settings HOT 1
- Discrepancy in documentation of password rotation. HOT 5
- Next.js middleware token rotation issue HOT 3
- Unable to create a session cookie HOT 3
- How to access stored sessions of my users?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iron-session.