firebase / firebase/firebase-admin-node

[messaging] TypeError: Value is not an object: undefined

Đang mở
#2,037 20 bình luận 0 reaction 1 người được giao Được @lahirumaramba nhận Xem trên GitHub
api: messaging
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ả

### [REQUIRED] Step 2: Describe your environment

* Operating System version: MongoDB Atlas Trigger (Realm App)
* Firebase SDK version: 11.4.1
* Firebase Product: messaging
* JS SDK Version: [3.18.0](https://github.com/mongodb/stitch-js-sdk/releases/tag/v3.18.0)
* NPM version: I don't know

### [REQUIRED] Step 3: Describe the problem

Executing `admin.messaging().sendMulticast(message)` returns an error and is not working anymore after upgrading to `firebase-admin: 11.4.1` from `11.0.1` and with the release of [fastify/busboy 1.2.0](https://github.com/firebase/firebase-admin-node/issues/1902#issuecomment-1373978366) :

```
uncaught promise rejection: TypeError: Value is not an object: undefined
```

The difference with my previous issue #1902 is that now `messaging().sendMulticat(message)` is crashing and no longer deliver the push notification.

#### Steps to reproduce:

1. Create a MongoDB Atlas trigger
2. Add `firebase-admin` as external dependency and make sure it's `11.4.1`
3. Add the service-account.json as a `value`
4. Run the code with the below code

#### Relevant Code:

```
exports = async function() {

const admin = require("firebase-admin");
const json_creds = context.values.get("service_account_value_name");

const title = "Test";
const body = "This is a test";

const message= {
android: {
notification: {
title: title,
sound: "default",
body: body,
},
},
apns: {
payload: {
aps: {
alert: {
title: title,
body: body,
},
mutableContent: 1,
contentAvailable: 1
}
},
},
tokens: ["device_token_1", "device_token_2"]
};

admin.initializeApp({
credential: admin.credential.cert(JSON.parse(json_creds))
});

admin.messaging().sendMulticast(message);

console.log("Messages sent !");
}
}
```

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.