firebase / firebase-admin-node

Firebase Admin Node.js SDK

Home Page:https://firebase.google.com/docs/admin/setup

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: Cannot read properties of undefined (reading 'match')

rishabhAjay opened this issue · comments

Environment

  • Operating System version: Windows 10
  • Firebase SDK version: 11.11.0
  • Firebase Product: Cloud Messaging
  • Node.js version: 18.17.1
  • NPM version: 9.8.1

The Error:

After I upgraded firebase-admin to the latest version, this error popped up:

TypeError: Cannot read properties of undefined (reading 'match')
    at scanIdentifier (C:\Users\User\Desktop\Project\node_modules\doctrine\lib\doctrine.js:259:96)
    at parseName (C:\Users\User\Desktop\Project\node_modules\doctrine\lib\doctrine.js:317:29)
    at TagParser._parseNamePath (C:\Users\User\Desktop\Project\node_modules\doctrine\lib\doctrine.js:474:20)
    at TagParser.parseNamePathOptional (C:\Users\User\Desktop\Project\node_modules\doctrine\lib\doctrine.js:491:25)
    at TagParser.parse (C:\Users\User\Desktop\Project\node_modules\doctrine\lib\doctrine.js:769:34)
    at parseTag (C:\Users\User\Desktop\Project\node_modules\doctrine\lib\doctrine.js:790:26)
    at Object.parse (C:\Users\User\Desktop\Project\node_modules\doctrine\lib\doctrine.js:868:23)
    at build (C:\Users\User\Desktop\Project\node_modules\swagger-jsdoc\src\specification.js:227:39)
    at module.exports (C:\Users\User\Desktop\Project\node_modules\swagger-jsdoc\src\lib.js:32:10)
    at Object.<anonymous> (C:\Users\User\Desktop\Project\src\utils\swagger.ts:31:33)

I am using swagger-jsdoc(v6.2.5)

Steps to reproduce:

I did some digging by console logging the incoming input from where the error was thrown:

PRINTING THE SOURCE FROM doctrine:
The FirebaseAuthRequestHandler constructor used to initialize an instance using a FirebaseApp.

@param app - The app used to fetch access tokens to sign API requests.
@constructor.
PRINTING THE SOURCE FROM doctrine:
The FirebaseAuthRequestHandler constructor used to initialize an instance using a FirebaseApp.

@param app - The app used to fetch access tokens to sign API requests.
@constructor.

There is a "." after the @constructor YAML definition. Was this intended? I removed this dot and reran the application. The error did not resurface after this change.

Relevant Code:

Screenshots of the path and code in the package:
dotInConstructor

2023-09-29 22_51_16-auth-api-request d ts - OIG-Nodejs - Visual Studio Code

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

Thank you @rishabhAjay for filing this issue. Looks like a typo. Let's discuss on #2321

Hello @lahirumaramba,
Still I am facing the same issue with below environment. This MR change is not reflected. Please check and verify

Environment

  • Firebase SDK version: 11.11.0
  • Firebase Product: Cloud Messaging
  • Node.js version: 18.16.0
  • NPM version: 9.5.1

Yeah. Just checked it by downloading the latest version of the package. That line of code apparently still persists. However, I was able to fix it by changing the paths in the apis field of the swaggerJSDoc options to only read the yaml specified in my route files instead of scanning the whole project(something like src/routes/*). @ronakdiyora

Thank you for quick reply @rishabhAjay. Yes, you are right. We do not need to scan the whole project for swagger.