-
-
Notifications
You must be signed in to change notification settings - Fork 213
Open
Labels
Type: BugSomething isn't workingSomething isn't working
Description
Package Edition of Nebula Logger
Unlocked Package
Package Version of Nebula Logger
4.16.2
New Bug Summary
I'm trying to log a platform event with the method Logger.info( String message, sObject record );
When I put a non published event in this method, it works perfectly fine, but when I log this event after being published, it fails with error System.SObjectException Invalid field Id
I think its a salesforce bug but it could be easily fixed by knowing we are logging a platform event record that as no Id in Class.LogEntryEventBuilder.setRecord: line 463 ( I personnaly use EventUUID field but it won't work in this case because it's a guuid field and not a proper salesforce Id field... )
Here is a simple anonymous block to reproduce:
CustomEvent__e e = new CustomEvent__e( Name__c = 'test');
Logger.info('Before Publishing event ',e); //works fine
EventBus.publish(e);
system.debug('Event published!!');
Logger.info('After Publishing event ',e); //fail with System.SObjectException Invalid field Id
/*
Stack Trace
Error: Class.LogEntryEventBuilder.setRecord: line 463, column 1
Class.LogEntryEventBuilder.setRecordId: line 407, column 1
Class.Logger.info: line 1827, column 1
AnonymousBlock: line 5, column 1
*/
With this anonymous block, the debug Event published!! is correctly logged.
Metadata
Metadata
Assignees
Labels
Type: BugSomething isn't workingSomething isn't working