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

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

Closed
rishabhAjay opened this issue Sep 29, 2023 · 5 comments · Fixed by #2321
Closed

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

rishabhAjay opened this issue Sep 29, 2023 · 5 comments · Fixed by #2321
Assignees

Comments

@rishabhAjay
Copy link
Contributor

rishabhAjay commented Sep 29, 2023

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
@google-oss-bot
Copy link

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.

rishabhAjay added a commit to rishabhAjay/firebase-admin-node that referenced this issue Sep 30, 2023
@lahirumaramba lahirumaramba self-assigned this Oct 3, 2023
@lahirumaramba
Copy link
Member

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

lahirumaramba pushed a commit that referenced this issue Oct 3, 2023
pragatimodi pushed a commit that referenced this issue Oct 18, 2023
pragatimodi added a commit that referenced this issue Oct 18, 2023
passkey config admin changes

Bug Fix for issue #2320 (#2321)

fixed unit test errors

lint fixes + integration

remove integration tests

adding comments

undo package json changes

undo package json changes
@ronakdiyora
Copy link

ronakdiyora commented Nov 1, 2023

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

@rishabhAjay
Copy link
Contributor Author

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

@ronakdiyora
Copy link

ronakdiyora commented Nov 1, 2023

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

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

Successfully merging a pull request may close this issue.

4 participants