Internal server error. No devices found exception - ios

I get the following error for iOS when I tried to send push notification via MFP console
{
"code": "FPWSE0009E",
"message": "Internal server error. No devices found.",
"productVersion": "8.0.0.00-20170220-1900"
}
The device is active . The is the result from the "Devices" API
{
"productVersion": "8.0.0.00-20170220-1900",
"totalListSize": 4,
"items": [
{
"id": "0AC11F77-A89A-4616-9085-4F6009329F3",
"lastAccessed": "2017-07-12T16:13:56.985Z",
"status": "ACTIVE",
"deviceOs": "ios 10.2.1",
"deviceModel": "iPhone",
"applicationDeviceAssociations": [
{
"appName": "RandstadJobsiOS",
"appId": "com.randstadusa.randstadjobs$ios$2.0.1",
"certSerialNumber": "",
"deviceId": "0AC11F77-A89A-4616-9085-4F6009329F3",
"status": "ENABLED",
"deviceStatus": "ACTIVE"
}
]
},
..
Push is working for android.
The iOS push certification is valid and will expire in 2018. I used the same cert in prod and receive push notification
Additionally,I tried to debug in Xcode and it does the following
MFPPush.isPushSupported -- return true
MFPPush.initialize - return success
However, it does not execute the MFPPush.registerDevice in the code
** Update
#Vivin
When the the Subscription API is executed I get the result
{
"code": "FPWSE0001E",
"message": "Not Found - The target resource 'PushDevice' does not exist. Check the '0AC11F77-A89A-4616-9085-4F6009329F3' parameter.",
"productVersion": "8.0.0.00-20170220-1900"
}
Please let me know how to debug this issue

Related

Flutter IOS firebase_message only work in firebase console

i've developed crossplatform app using flutter with firebase_message plugin.
it works well in android system but push notification does not work in IOS partially
when i try to send push notification from firebase console web to all of IOS devices, it works well
but if i try to send using POST method with
<header start>
Authorization : <Firebase server key>
<header end>
{
"collapse_key" : "type_a",
"priority" : "high",
"notification" : {
"body" : "bd",
"title": "tt",
"android_channel_id": "noti_push_NEW_PLAY"
"sound": "NEW_MESSAGE.wav"
},
"data" : {
"click_action": "FLUTTER_NOTIFICATION_CLICK"
"type": "NEW_MESSAGE",
},
"apns": {
"payload": {
"aps": {
"sound": "NEW_MESSAGE.wav",
}
}
},
"to" : <token>,
}
push notificaion does not works in IOS with error NotRegistered
{
"multicast_id": <returned id>,
"success": 0,
"failure": 1,
"canonical_ids": 0,
"results": [
{
"error": "NotRegistered"
}
]
}
i don't think it is related with settings, because i can send push message to all IOS devices from firebase web console. but if i try to send it tor specific device, i can't.
i followed all step firebase setup, APN certificate, Apple id, Adding Xcode push notification capablity, etc...
what's the problem???
thanks
I've just resolved it to add
FirebaseAppDelegateProxyEnabled = YES
in info.plist
Not Receiving push notifications from firebase

Push notifications via Firebase not appearing on iOS with app on background

We are developing an Ionic app for Android and iOS that has Push Notifications. We send these notifications via Firebase Cloud Messaging
On iOS we have this problem (we have accepted Notifications Permission for the app):
When the app is in foreground, we get the notification instantly (we get it inside the app, not with a card).
When the app is closed or in background it seems like we do not get the notification. However wehn we open or resume the app, we get the notification as is it was recieved with the app in foreground. Our hypothesis is that we are getting silent notifications.
(When we send Firebase test notification we get the same behaviour).
We have the next configurations:
Xcode: Capabilities -> Background Modes -> Remote Notifications (shows one check)
Xcode: Capabilities -> Push Notifications (shows two checks)
Apple Developer: Identifiers -> my app -> Push Notifications (with certificates for both dev and prod)
Apple Developer: Keys -> .p8 key with "Apple Push Notifications service (APNs)"
Firebase: my app -> Configuration -> Cloud Messaging (.p8 file uploaded with key and team IDs)
This is one of the several notifications we have tried to send via Firebase POST API, which combines almost everything we have read while researching this problem. (we also send required Firebase HTTP headers)
{
"to": "<firebase_token>",
"notification": {
"body": "NOTIFICATION BODY",
"title": "NOTIFICATION TITLE",
},
"apns": {
"headers": {
"apns-push-type": "alert",
"apns-expiration": 0,
"apns-priority": 5,
"apns-topic": "<my_app>"
},
"payload": {
"alert": {
"title": "NOTIFICATION TITLE",
"body": "NOTIFICATION BODY"
},
"aps": {
"content-available": 1,
"alert": {
"title": "NOTIFICATION TITLE",
"body": "NOTIFICATION BODY"
}
},
"sound": "default",
"content-available": 1
}
},
"data": {
"field": "1",
"type": "CHAR"
}
}
Despite this POST request may be incorrect for bacground notifications, we believe that would not be the problem, as Firebase test notifications also fail to show when on background.
We finally were able to get notifications with app on background and on foreground.
The payload for Firebase is:
{
"to": "<firebase token>",
"notification": {
"title": "TITLE",
"body": "BODY"
},
"data": {
"title": "TITLE",
"body": "BODY",
"extraField1": "extra value 1",
"extraField2": "extra value 2"
},
"apns": {
"headers": {
"apns-topic": "<my-app>",
"apns-push-type": "background",
"apns-priority": 10
}
}
}
It looked like there were an problem with .p12 certificates after updating to iOS 13 that we solved using a .p8 cert. After changing the certificates at Firebase the background notifications started to be recieved, but foreground stopped for the first hours.
I am not sure, But it seems like your payload structure is not proper.
Please refer below sample
{
"to" : "FCM TOKEN",
"notification" : {
"body" : "Body of Your Notification",
"title": "Title of Your Notification"
},
"data" : {
"body" : "Body of Your Notification in Data",
"title": "Title of Your Notification in Title",
"key_1" : "Value for key_1",
"key_2" : "Value for key_2"
}
}
If you're working with normal APNS then no need to pass content-available
Look for the message in XCode logs. Here is what I got, see below:
In the js code to access body, use data.aps.alert.body
this.fcm.onNotification().subscribe(data => {
console.log("notifiation data", data);
alert(data.aps.alert.body);
Message ID 1: 1593974546767029
{
aps = {
alert = {
body = "Hi, this is ios and android test 6!!!";
title = " iOS and Android Test";
};
badge = 1;
sound = default;
};
"gcm.message_id" = 1593974546767029;
"gcm.n.e" = 1;
"gcm.notification.sound2" = default;
"google.c.a.c_id" = 2904766990309581961;
"google.c.a.e" = 1;
"google.c.a.ts" = 1593974546;
"google.c.a.udt" = 0;
"google.c.sender.id" = 291488852090;
}

Push Notifications work from FCM console but if sent from API show “InvalidApnsCredential” error (only on iOS devices)

Push notification FMC API doesn't work on iOS
I tried to verify my APNS certificates and seems okay
From FMC console testing notifications work and arrive successfully to iOS devices
Endpoint url
https://fcm.googleapis.com/fcm/send
Request headers:
Content-Type:application/json
Authorization:key=**SERVER_KEY**
Request payload body:
{
"to": "**FMC_DEVICE_TOKEN**",
"priority": "high",
"notification": {
"title": "Title",
"body" : "First Notification",
"text": "Text"
}
}
Response body:
{
"multicast_id": 6714208302733418144,
"success": 0,
"failure": 1,
"canonical_ids": 0,
"results": [
{
"error": "InvalidApnsCredential"
}
]
}
This is apparently a global issue from Firebase today. Many people have been reporting this error in the past 3 hours. I hope it's gonna be fixed tomorrow.

How to send push notification from Rest API

I have created my App in Firebase and configured for cloud messaging.
When I am sending the notification from Firebase Console, device gets the notification but if I try to send via Rest API (Using PostMan).
Then notification not coming to device but the response is showing as Success.
Here is my PostMan request
URI - https://fcm.googleapis.com/fcm/send
Header: Content-Type:application/json Authorization:key=MY_SERVER_KEY
Body: { "data": { "title": "Firebase", "detail": "I am firebase" },
"to" : "MY FCM TOKEN HERE" }
Response : {
"multicast_id": 7834540847388366233,
"success": 1,
"failure": 0,
"canonical_ids": 0,
"results": [
{
"message_id": "0:1532422122326299%ebf5f25ef9fd7ecd"
}
] }
I have searched and it seems the way mentioned in documentation is same as I am following
Can anyone let me know why it is not working?
Thanks
I am posting here so as to guide others. As per the guidance of #rv7284, We need to send the data in notification key rather any other key.
So While requesting the body should look like this, Other request parameter like header and all will be same as mentioned in the question.
{ "notification": {
"title": "Firebase",
"detail": "I am firebase"
},
"to" : "YOUR FCM TOKEN"
}

Submitting a transaction via RESTful API (how to handle transactionid and timestamp)

Problem:
I am unable to POST a transaction via the RESTful API generated by the composer-rest-server. I am receiving statusCode 422; the transaction instance is not valid. However, the same example works in the Playground.
Scenario:
I've set up a transaction called Offer in my .cto file which posts an offer to buy a house:
// Offer - Specifies an offer that a bidder places on a house listing with an associated price
transaction Offer {
o Double bidPrice
--> HouseListing listing
--> Person bidder
}
The composer-rest-server has generated an API with the following JSON string to post a transaction of type Offer:
{
"$class": "org.acme.purchasing.Offer",
"bidPrice": 0,
"listing": "string",
"bidder": "string",
"transactionId": "string",
"timestamp": "2017-07-21T13:37:09.460Z"
}
I've since replaced this with a sample transaction using the following JSON code derived from the above example:
{
"$class": "org.acme.purchasing.Offer",
"bidPrice": 1000,
"listing": "001",
"bidder": "RJOHNSON",
"transactionId": "1b9aa63c-dfad-4aad-a610-dfc80f2796b2",
"timestamp": "2017-07-21T13:37:09.460Z"
}
The response returned is error code 422:
{
"error": {
"statusCode": 422,
"name": "ValidationError",
"message": "The `Offer` instance is not valid. Details: `transactionId` can't be set (value: \"1b9aa63c-dfad-4aad-a610-d...6b2\").",
"details": {
"context": "Offer",
"codes": {
"transactionId": [
"absence"
]
},
"messages": {
"transactionId": [
"can't be set"
]
}
},
"stack": "ValidationError: The `Offer` instance is not valid. Details: `transactionId` can't be set (value: \"1b9aa63c-dfad-4aad-a610-d...6b2\").\n at /usr/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/dao.js:355:12\n at ModelConstructor.<anonymous> (/usr/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/validations.js:566:11)\n at ModelConstructor.next (/usr/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/hooks.js:93:12)\n at ModelConstructor.<anonymous> (/usr/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/validations.js:563:23)\n at ModelConstructor.trigger (/usr/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/hooks.js:83:12)\n at ModelConstructor.Validatable.isValid (/usr/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/validations.js:529:8)\n at /usr/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/dao.js:351:9\n at doNotify (/usr/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:155:49)\n at doNotify (/usr/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:155:49)\n at doNotify (/usr/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:155:49)\n at doNotify (/usr/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:155:49)\n at Function.ObserverMixin._notifyBaseObservers (/usr/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:178:5)\n at Function.ObserverMixin.notifyObserversOf (/usr/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:153:8)\n at Function.ObserverMixin._notifyBaseObservers (/usr/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:176:15)\n at Function.ObserverMixin.notifyObserversOf (/usr/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:153:8)\n at Function.ObserverMixin._notifyBaseObservers (/usr/lib/node_modules/composer-rest-server/node_modules/loopback-datasource-juggler/lib/observer.js:176:15)"
}
}
Now the strange thing is that I've deployed the same BNA onto the Hyperledger Composer Playground and am able to execute transactions of type Offer successfully.
Note that in the Playground, "transactionId" and "timestamp" are not specified as the Playground appears to take care of these values. For example, this is what Playground proposes to me initially:
{
"$class": "org.acme.purchasing.Offer",
"bidPrice": 0,
"listing": "resource:org.acme.purchasing.HouseListing#id:7965",
"bidder": "resource:org.acme.purchasing.Person#id:4441"
}
Can anyone advise why it's saying the Offer instance is not valid? My first thought was that it's not liking the string I'm placing in "transactionId" but another Stack Overflow post points out that the transactionId is just an arbitrary UUIDv4 string which I've generated already.
Update #1: Failing even with default demo
In order to ensure by BNA is error-free, I've deployed the default carauction-demo (resembles my example closely) onto my local Hyperledger Fabric instance and deployed the composer-rest-server. I've also deployed the same BNA into the Playground. All assets and participants were created identical in both from the Explorer (local instance) and Playground. When it comes time to submit an Offer transaction:
{
"$class": "org.acme.vehicle.auction.Offer",
"bidPrice": 800,
"listing": "resource:org.acme.vehicle.auction.VehicleListing#L001",
"member": "resource:org.acme.vehicle.auction.Member#member3#acme.org"
}
This JSON was generated by the Playground and succeeds there. Copy/paste/executing into the Explorer yields a status 500 error.
{
"error": {
"statusCode": 500,
"name": "Error",
"message": "error trying invoke chaincode. Error: chaincode error (status: 500, message: Error: Object with ID 'string' in collection with ID 'Asset:org.acme.vehicle.auction.VehicleListing' does not exist)",
"stack": "Error: error trying invoke chaincode. Error: chaincode error (status: 500, message: Error: Object with ID 'string' in collection with ID 'Asset:org.acme.vehicle.auction.VehicleListing' does not exist)\n at _initializeChannel.then.then.then.then.catch (/usr/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:806:34)"
}
}
I'm still at a lost as to what is wrong here.
After much experimentation and some searching, I've concluded that the problem was that NPM was installed using sudo (as root). I redid the installation as non-root and the problem has now been solved. Everything is working as expected.
Composer updates the transactionId itself as its generated, you cannot do this in your JSON and hence why you get the error. This is a Loopback -> Swagger conversion issue as it should not appear in a /POST REST operation - captured here https://github.com/hyperledger/composer/issues/663
So I have successfully executed Offer transactions (/POST). I think the '500' error is because there is a missing field ('string' type), or relationship in your Offer transaction via REST.
Using the example of the Car Auction network https://github.com/hyperledger/composer-sample-networks/blob/master/packages/carauction-network/models/auction.cto
Either of these Offer transactions using /POST were successful in Explorer:
{
"$class": "org.acme.vehicle.auction.Offer",
"bidPrice": 20,
"listing": "org.acme.vehicle.auction.VehicleListing#100",
"member": "org.acme.vehicle.auction.Member#a#b.com"
}
OR
{
"$class": "org.acme.vehicle.auction.Offer",
"bidPrice": 20,
"listing": "org.acme.vehicle.auction.VehicleListing#100",
"member": "org.acme.vehicle.auction.Member#a#b.com",
"timestamp": "2017-07-28T14:07:02.558Z"
}
responded with a 200 (SUCCESS) and a transactionId in Explorer:
{
"$class": "org.acme.vehicle.auction.Offer",
"bidPrice": 20,
"listing": "org.acme.vehicle.auction.VehicleListing#100",
"member": "org.acme.vehicle.auction.Member#a#b.com",
"transactionId": "e75b9934-1f08-4daf-90db-702bbe4b8fa1"
}
This is my VehicleListing asset JSON for #100 above
{
"$class": "org.acme.vehicle.auction.VehicleListing",
"listingId": "100",
"reservePrice": 50,
"description": "string",
"state": "FOR_SALE",
"offers": [
{
"$class": "org.acme.vehicle.auction.Offer",
"bidPrice": 50,
"listing": "100",
"member": "resource:org.acme.vehicle.auction.Member#a#b.com",
"transactionId": "string123",
"timestamp": "2017-07-28T14:07:02.825Z"
}
],
"vehicle": "resource:org.acme.vehicle.auction.Vehicle#123"
}
And I created asset for Vehicle 123 as well as Member a#b.com

Resources