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

Cannot destructure cookies in derive anymore #737

Open
folland87 opened this issue Jul 18, 2024 · 1 comment
Open

Cannot destructure cookies in derive anymore #737

folland87 opened this issue Jul 18, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@folland87
Copy link

What version of Elysia.JS is running?

1.1.3

What platform is your computer?

Linux 6.5.0-44-generic x86_64 x86_64

What steps can reproduce the bug?

import { Elysia } from "elysia";

const app = new Elysia()
  .derive(({ error, cookie: { accessToken } }) => {
    if (!accessToken) {
      return { isConnected: true };
    }
    return { currentUser: false };
  })
  .get("/hello", async ({ currentUser, error }) => {
    if (currentUser) {
      return { message: "world" };
    }
    return error(401, { message: "Error" });
  })
  .listen(3000);

console.log(
  `🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`,
);

What is the expected behavior?

Destructure accessToken as in 1.0.*

What do you see instead?

{"name":"TypeError","message":"Right side of assignment cannot be destructured"}

Additional information

No response

@folland87 folland87 added the bug Something isn't working label Jul 18, 2024
@askareija
Copy link

i have this error too after updating elysia

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants