Code Monkey home page Code Monkey logo

elysia-basic-auth's Introduction

Hi there ๐Ÿ‘‹

elysia-basic-auth's People

Contributors

eelkevdbos avatar kilianb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

elysia-basic-auth's Issues

`addError is undefined` when added as middleware to Elysia 0.8.9 project

Hello!

Firstly, a huge thanks for this project โ€” the time and effort you've put into making sure this is really well thought out with awesome tests and a proper security mindset is amazing. We're really grateful and plan to use this in a new project.

I've tried to set up a Elysia 0.8.9 project with this package, however the server fails to start as soon as I add basicAuth as middleware with the following error:

TypeError: app.state("basicAuthRealm", null).state("basicAuthUser", null).addError is not a function. (In 'app.state("basicAuthRealm", null).state("basicAuthUser", null).addError({ BASIC_AUTH_ERROR: BasicAuthError })', 'app.state("basicAuthRealm", null).state("basicAuthUser", null).addError' is undefined)
      at /<redacted>/node_modules/@eelkevdbos/elysia-basic-auth/dist/index.js:102:10
      at _use (/<redacted>/node_modules/elysia/dist/bun/index.js:361:32813)
      at /<redacted>/src/index.ts:7:20
 97 |     };
 98 |     const credentialsMap = newCredentialsMap(options.credentials);
 99 |     const inScope = newScopePredicate(options.scope);
100 |     const skipRequest = (request) => options.skipCorsPreflight && isCORSPreflightRequest(request);
101 |     return (app) => app
102 |         .state('basicAuthRealm', null)
               ^

It appears as though despite the fact there is a peerDependency on ^0.8.1 the actual bun.lockb contains 0.6.16:

$ bun pm ls
elysia-basic-auth node_modules (11)
โ”œโ”€โ”€ [email protected]
โ”œโ”€โ”€ [email protected]
โ”œโ”€โ”€ [email protected]

In Elysia 0.7.0, addError was renamed to error which I think is the root cause of the above issue.

I have prepared a small PR fix for this, which I will link to this issue shortly.

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.