jongpie / NebulaLogger

The most robust observability solution for Salesforce experts. Built 100% natively on the platform, and designed to work seamlessly with Apex, Lightning Components, Flow, Process Builder & integrations.
https://nebulalogger.com
MIT License
708 stars 164 forks source link

Facing intermittent INVALID_REFERENCE_KEY Error while logging #798

Open rishabkumar-03 opened 1 week ago

rishabkumar-03 commented 1 week ago

Package Edition of Nebula Logger

Unlocked Package

Package Version of Nebula Logger

v4.14.13

New Bug Summary

We started getting INVALID_REFERENCE_KEY error recently and it is intermittent. There's no issue with majority of Rest APIs that we're using but intermittently fails for a few. There's no valuable information in the debug logs that might indicate what the issue is. We've updated the package to the latest version of the (v4.14.13) but still encountering the issue. Happens 2-3 times a week.

Error message : {"message":"Upsert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: []"}

Stack trace for the Nebula Logger classes:
 LoggerDataStore.Database.upsertRecords: line 266, column 1
 Class.LogEntryEventHandler.upsertLogEntries: line 368, column 1
 Class.LogEntryEventHandler.executeAfterInsert: line 63, column 1
 Class.LoggerSObjectHandler.execute: line 125, column 1
 Class.Logger.saveLog: line 3237, column 1
 Class.Logger.saveLog: line 3150

We understand it is related to some lookup field as we are logging Log Entries for the entire transaction but no luck in getting to know the root cause and what is weird is, it works fine most of time time and fails for a few transactions. There has been no change in code since we started getting the issue. Any help/suggestion is appreciated. Thank you!

rishabkumar-03 commented 1 week ago

@jongpie