dotansimha / graphql-yoga

🧘 Rewrite of a fully-featured GraphQL Server with focus on easy setup, performance & great developer experience. The core of Yoga implements WHATWG Fetch API and can run/deploy on any JS environment.
https://the-guild.dev/graphql/yoga-server
MIT License
8.25k stars 574 forks source link

JWT plugin: Authentication is not available at the moment. #3456

Open zneel opened 2 weeks ago

zneel commented 2 weeks ago

Describe the bug

ERR 68 |                 console.log('decodedToken', decodedToken);
69 |                 // Fetch the signing key based on the key id.
70 |                 const signingKey = await getSigningKey(decodedToken?.header.kid);
71 |                 if (!signingKey) {
72 |                     logger.warn(`Signing key is not available for the key id: ${decodedToken?.header.kid}. Please make sure signing key providers are configured correctly.`);
73 |                     throw Error(`Authentication is not available at the moment.`);
                               ^
error: Authentication is not available at the moment.
      at /Users//workspace///node_modules/@graphql-yoga/plugin-jwt/esm/plugin.js:73:27
      at processTicksAndRejections (native:7:39)
createRemoteJwksSigningKeyProvider({
            jwksUri: config.jwks.uri, (can be any jwks i guess)
            cache: true,
            rateLimit: true,
            cacheMaxAge: 60 * 60 * 24 * 30, // 30 days
          }),

is there by any chance a fix with this version? (I'm using bun) https://github.com/auth0/node-jwks-rsa/releases/tag/v3.1.0 https://github.com/auth0/node-jwks-rsa/pull/374 Or a workaround?

Your Example Website or App

dev env

Steps to Reproduce the Bug or Issue

  1. Create a new yoga project using Bun
  2. Add jwt plugin
  3. Setup createRemoteJwksSigningKeyProvider
  4. Authentication is not available at the moment.

Expected behavior

Im pretty new to bun but i guess it should work

Screenshots or Videos

No response

Platform

Additional context

Let me know if the context isnt clear enough or if you need other repro steps... Thanks for the great lib No response