You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I went in and added debug to show me the e.stack on line 237 of core/components/endpoint.js:
responseP
.then((result) => {
if (callback) {
callback(status, result);
} else if (promiseComponent) {
promiseComponent.fulfill(result);
}
})
.catch((e) => {
console.log(`onResponse caught error at ${JSON.stringify(e.stack, null, 3)}`); // DEBUG HERE
if (callback) {
let errorData = e;
if (endpoint.getOperation() === operationConstants.PNSubscribeOperation) {
errorData = {
statusCode: 400,
error: true,
operation: endpoint.getOperation(),
errorData: e,
category: categoryConstants.PNUnknownCategory,
};
}
callback(errorData, null);
} else if (promiseComponent) {
promiseComponent.reject(new PubNubError('PubNub call failed, check status for details', e));
}
});
The response was pretty obvious:
onResponse caught error at "TypeError: Cannot read properties of undefined (reading 'replace')\n at Object.presence ..... pubnub-javascript/lib/core/components/endpoint.js:235:17\n at processTicksAndRejections (node:internal/process/task_queues:96:5)"
It would have saved me a lot of time if the errorData contained at least some information.
The text was updated successfully, but these errors were encountered:
semireg
changed the title
Listener exceptions generate status 400, error should contain contextual error information
Listener exception generates status 400, error should contain contextual error information
May 9, 2023
I assume this is a server-side problem as there is nothing wrong with the code you mentioned I did not get a chance to go through the SDK docs to Consult the documentation or API reference provided by the server to understand the expected request format and any specific requirements for subscribing with presence. apart from that the SDK needs to be updated
Try wrapping your entire listener function in a try/catch. You might be throwing inside. The previous comment (Ali) doesn’t understand that this is a pubnub SDK issue. There is no pubnub error … the SDK just hides your own listener’s exception. On Jun 9, 2023, at 8:27 AM, Bhupendra Kumar ***@***.***> wrote:
we are also experiencing a lot of errors related to PNUnknownCategory while subscribing to the listener.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
Hi,
It took me a few days to track down the source of a strange subscription bug.
In my case, I had a listener with a presence function such as:
Upon connection and subscription withPresence, this generates a status listener event with code 400 and empty errorData:
I went in and added debug to show me the e.stack on line 237 of core/components/endpoint.js:
The response was pretty obvious:
It would have saved me a lot of time if the errorData contained at least some information.
The text was updated successfully, but these errors were encountered: