Skip to content

the response from any exported function/method was not Promise able #14

@asaromi

Description

@asaromi

Spec:

  • Framework: NestJS v11

I've following the sample from README.md, but the error was detected.
ESLint: Unexpected await of a non-Promise (non-"Thenable") value. (@typescript-eslint/await-thenable)

Usage:

  1. sign
      const token = await sign(
        this.privateKey,
        {
          userId,
          username,
          roles,
          type: opts.type,
          iss: this.issuer,
          exp: opts.exp,
        },
        { addIat: true, addExp: true },
      )
  1. verify
      const { payload } = (await verify(this.publicKey, token)) as { payload: AuthPayload }
      if (!payload) throw new UnauthorizedException('Failed to verify token')
      else if (payload.type !== type) throw new UnauthorizedException('Invalid token type')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions