pozil / pub-sub-api-node-client

A node client for the Salesforce Pub/Sub API
Creative Commons Zero v1.0 Universal
69 stars 34 forks source link

Error: Failed to load schema with ID 2fr-Hbmw3Qw3s3m0wCd2Ug #36

Closed rjruigrok closed 3 weeks ago

rjruigrok commented 2 months ago

@pozil It took us some time, but finally found the time to release an update for our pubsub implementation, after your improvements earlier this year. It now loads the right custom schema fine! 👍

I also tried to switch to the infinite looping, so that I dont have to handle the lastevent myself anymore.

Unfortunately this resulted in an issue. From some certain replay id on, it tried to load the next, but then failed to load the schema for some reason. I reimplemented therefore my own lastevent handling, and limited the amount of events per time to just 5. Then it was able to catch up without this error. So it seems that when it receives a bulk amount of events at once, the schema might change?

{
  message: 'gRPC stream error: {"cause":{},"replayId":1104717,"event":{"event":{"id":"aae06dfc-d895-463b-a38a-dd12858a2ea5","schemaId":"2fr-Hbmw3Qw3s3m0wCd2Ug","payload":{"type":"Buffer","data":[14,67,111,110,116,......anonymized......]}},"replayId":{"type":"Buffer","data":[0,0,0,0,0,16,219,77,0,0]}},"latestReplayId":1104761}'
}
{
  code: 'error.pubsubclient.msg',
  message: EventParseError: Failed to parse event with replay ID 1104717
      at /srv/dist/node_modules/salesforce-pubsub-api-client/dist/client.cjs:858:34
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
    cause: Error: Failed to load schema with ID 2fr-Hbmw3Qw3s3m0wCd2Ug
        at #getEventSchemaFromId (/srv/dist/node_modules/salesforce-pubsub-api-client/dist/client.cjs:1024:15)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async /srv/dist/node_modules/salesforce-pubsub-api-client/dist/client.cjs:829:26 {
      [cause]: [Error]
    },
    replayId: 1104717,
    event: {
      event: [Object],
      replayId: <Buffer 00 00 00 00 00 10 db 4d 00 00>
    },
    latestReplayId: 1104761
  },
  level: 'error',
  httpcode: 200,
  context: {}
}
pozil commented 2 months ago

Hi @rjruigrok, thanks for reporting this issue. I must admit that I don't understand why the schema ID would suddenly change in a batch and why the gRPC call to retrieve it would fail. I'll ask the Pub/Sub API team if they have a lead on this.

pozil commented 3 weeks ago

Hi @rjruigrok, I believe that this issue is fixed in the latest version so I'll close. Feel free to reopen if this is not the case.