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

ERROR [AuthGuard] undefined #15

Open
aauffray opened this issue Feb 2, 2023 · 1 comment
Open

ERROR [AuthGuard] undefined #15

aauffray opened this issue Feb 2, 2023 · 1 comment

Comments

@aauffray
Copy link

aauffray commented Feb 2, 2023

My NestJS server logs an ERROR [AuthGuard] undefined in production, but everything works fine and the API key is checked correctly. I don't see the error locally.

Version : 1.2.2

My middleware :

import { Injectable, UnauthorizedException } from '@nestjs/common';
import { PassportStrategy } from '@nestjs/passport';
import Strategy from 'passport-headerapikey';

@Injectable()
export class HeaderApiKeyStrategy extends PassportStrategy(
  Strategy,
  'api-key',
) {
  constructor() {
    super({ header: 'X-API-KEY', prefix: '' }, true, async (apiKey, done) => {
      return this.validate(apiKey, done);
    });
  }

  public validate = (apiKey: string, done: (error: Error, data) => {}) => {
   // my API key validation
  };
}

Is there something serious I should check ?

@adamgajzlerowicz
Copy link

I have the same error. For me it is nest js + FacebookStrategy. It appears after the callback is called, and before I am back in the controller. I can't find what causes is either. Tried to debug it with stepping over.. still nothing. But the feature works 🤷🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants