firebase / firebase/firebase-js-sdk
Build error: Cannot find namespace 'gapi' Cordova auth
- Dominant language
- TypeScript
- Stars
- 5.1k
- Forks
- 1k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 37
Description
### [REQUIRED] Describe your environment
* Operating System version: **iOS 16.1 & 16.2**
* Browser version: **16.1 (safari ios)**
* Firebase SDK version: **9.15.0**
* Firebase Product: **auth/cordova**
### [REQUIRED] Describe the problem
- If I try to use the getAuth method from firebase/auth/cordova, ts build errors are thrown when compiling my app.
- The error references the gapi namespace, claiming it cannot be found from the auth/cordova popup_redirect.d.ts file.
- `Error: node_modules/@firebase/auth/dist/cordova/src/model/popup_redirect.d.ts:30:40 - error TS2503: Cannot find namespace 'gapi'.`
- I suspect the the capacitor auth package does not need / use the gapi namespace, so it's possibly an error with your build tool configurations.
#### Steps to reproduce:
(in your own code)
- Import getAuth function from the auth/cordova package
- See the errors when trying to build your typescript project
(via SDK locally)
- clone the latest version of the sdk (9.15.0)
- install dependencies and yarn build
- See the build warning about gapi namespace
- Navigate to `packages/auth/dist/cordova/src/model/popup_redirect.d.ts`
- Assuming you have intellij or vscode, hover over `gapi.iframes.Message`, the lint error mentions the missing gapi namespace
#### Relevant Code:
Simple example to trigger error:
```javascript
import { getAuth as cordovaGetAuth } from 'firebase/auth/cordova';
const test = cordovaGetAuth();
console.log(test);
```
Contributor guide
Assessment
This issue has not been assessed yet.