Comments (5)
Can you please share the actual code that's causing the warning?
from lucia.
cross posting from the discord:
Line:
context.cookies.set(sessionCookie.name, sessionCookie.value, sessionCookie.attributes);
In:
/pages/api/logout.ts
/pages/api/login.ts
/pages/api/signup.ts
/middleware.ts
* 2
from lucia.
Main issue here seems to be that Astro's cookies.set
doesn't merely accept cookie attributes but select options from the cookie package's parse function. 7 out of 8 of these are actually just cookie attributes (what Oslo's type maps to) so it mostly works but Astro picks an additional type, the encode
option which is a function that the cookie package accepts for alternative encoding of the value.
I'm not sure there's a sensible way for Oslo to add this to its types, nor am I exactly sure why it is complaining, as what Oslo's cookie type contains is a completely valid subset of what Astros function takes for options. But it might be that it's mad because it doesn't have the possibility to even get its encode option based on Oslo's type.
It might be possible to do something like this, essentially telling TS we leave the ability to pass an encode option open:
cookies.set(sessionCookie.name, sessionCookie.value, { ...sessionCookie.attributes });
Not in a position to test it myself tho, but at a glance I think it might work.
from lucia.
I can't seem to reproduce the issue.
Property 'encode' is missing in type 'CookieAttributes' but required in type 'AstroCookieSetOptions'.
This error doesn't make sense since encode()
is optional in AstroCookieSetOptions
. Have you tried updating to the latest version of Astro?
from lucia.
This seems to be an issue with an older version of Astro. Updating to latest should fix the issue
from lucia.
Related Issues (20)
- [Bug]: SessionCookieAttributesOptions missing sameSite: "none" type
- [Docs]: use of "sure sure" seems unintentional HOT 2
- [Feature Request]: Edgedb adapter HOT 4
- oauth and nuxt tutortial (using mongodb)
- [Feature Request]: Telegram Mini App AND Lucia Auth HOT 1
- [Bug]: @lucia-auth/adapter-prisma HOT 1
- [Bug]: switch to hash @node-rs/argon2 breaks sveltekit production builds HOT 12
- [Feature Request]: battle.net HOT 1
- [Bug]: TypeError [ERR_INVALID_ARG_TYPE]: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received an instance of Date HOT 7
- [Bug]: Session validate response is null, validateSession returns null HOT 5
- [Docs]: missing import in example code
- [Docs]: Code example with astro integration not working
- [Docs]: Astro passwort/username guide contain typo
- how can i define a one to one extra DatabaseUserAttributes HOT 4
- [Docs]: typo in docs, related to nextJs HOT 3
- [Docs]: Usage of MongoDb adapter HOT 1
- [Bug]: Could not resolve "lucia/utils" when running 'wrangler dev' HOT 1
- [Docs]: Astro CSRF protection
- [Docs]: OAuth docs HOT 1
- [Bug]: Error: × You're importing a component that needs next/headers. That only works in a Server Component which is not supported in the pages/ directory. HOT 1
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 lucia.