Code Monkey home page Code Monkey logo

Comments (5)

pilcrowOnPaper avatar pilcrowOnPaper commented on June 1, 2024

Can you please share the actual code that's causing the warning?

from lucia.

wsor4035 avatar wsor4035 commented on June 1, 2024

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.

LinusOP avatar LinusOP commented on June 1, 2024

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.

pilcrowOnPaper avatar pilcrowOnPaper commented on June 1, 2024

I can't seem to reproduce the issue.

Screenshot 2024-04-19 at 23 26 02

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.

pilcrowOnPaper avatar pilcrowOnPaper commented on June 1, 2024

This seems to be an issue with an older version of Astro. Updating to latest should fix the issue

from lucia.

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.