firebase / firebase/firebase-admin-node

Windows - FirebaseAppCheckError: App attestation failed.

Đang mở
#2,308 10 bình luận 4 reaction 1 người được giao Được @lahirumaramba nhận Xem trên GitHub
api: appcheck
Ngôn ngữ chính
TypeScript
Star
1.7k
Fork
419
Merge trung bình
3 ngày 10 giờ
Pull request đã merge (30 ngày)
16

Mô tả

### Environment

* Operating System version: Windows 11
* Firebase SDK version: "firebase-admin": "^11.10.1"
* Firebase Product: appcheck
* Node.js version: 18.17.0
* NPM version: 9.6.7

### Problem description

When trying to use firebase admin SDK to generate custom appcheck token, the code throws the following exception:

```
FirebaseAppCheckError: App attestation failed.
at AppCheckApiClient.toFirebaseError (C:\Users\David\Projects\temp\node_modules\firebase-admin\lib\app-check\app-check-api-client-internal.js:150:16)
at C:\Users\David\Projects\temp\node_modules\firebase-admin\lib\app-check\app-check-api-client-internal.js:72:24
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
errorInfo: {
code: 'app-check/permission-denied',
message: 'App attestation failed.'
},
codePrefix: 'app-check'
}
```

This happens on my PC (Windows 11) and my laptop (Windows 11). However, it does not happen on my colleague's MacOS machine. The Firebase configuration was exactly the same on all these machines. I tried everything from switching node and dependency versions to tracing token requests with Wireshark to see the issue, but I just lost 3 whole days trying to fix this with no positive outcome. I seek any help I can.

#### Steps to reproduce:

I made a simple reproduction repo where the problem occurs: https://github.com/DavidDomkar/firebase-admin-app-check-create-token-bug

- You will need to create `.env` file based on `.env.example` and fill in the `FIREBASE_APP_ID` based on your project. Also, `service-account.json` file must be copied over to the repository root.
- Then run `yarn install && yarn tsc && node lib/index.js` to run the example and see the error.

Relevant Code:

```ts
import { initializeApp } from "firebase-admin/app";
import { getAppCheck } from "firebase-admin/app-check";

async function main() {
const app = initializeApp();
const appCheck = getAppCheck(app);
const token = await appCheck.createToken(process.env.FIREBASE_APP_ID);
console.log(token);
}

main();
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.