NebulaLogger icon indicating copy to clipboard operation
NebulaLogger copied to clipboard

callStatusApi During Test Class

Open jawills opened this issue 7 months ago • 2 comments

Package Edition of Nebula Logger

Unlocked Package

Package Version of Nebula Logger

4.16

New Bug Summary

I recently pushed changes to prod and received the following error:

 message: System.AssertException: Assertion Failed: unexpected endpoint https://api.status.salesforce.com/v1/instances/USA478/status
 stacktrace:
   Class.CustomIntegrationTest.Mock.respond: line 53, column 1
Class.Logger.callStatusApi: line 3816, column 1
Class.LogEntryEventHandler.StatusApiCalloutQueueable.execute: line 736, column 1

Error is from a mock class testing callouts to third-party system. Rerunning test classes resolved the issue.

jawills avatar Jun 24 '25 23:06 jawills

Hi @jawills - without seeing your test class, it's hard to say 100% for sure what's going on, but it sounds like your test is mocking a callout, and Nebula Logger's built-in callout to the status API is (sometimes) interfering. Since Nebula Logger's callout happens async, my guess is that it sometimes will finish before your own code's callout (resulting in your assert failing), but it might be inconsistent (hence why it worked when you re-ran the test classes).

If you're able to share any of your test method's code, I'm happy to take a look to see if there's a way to make things behave more reliably.

jongpie avatar Jun 30 '25 14:06 jongpie

Pretty much exactly what is happening. I had the same problem for another project as well. Adding the status url as and approved url for my mock class worked for a quick resolution.

I will try to simply the code for a minimum reproduction for you

jawills avatar Jul 01 '25 20:07 jawills