Our CI (Continuous Integration) build has started failing today on the sfdx force:source:push
with this error:
cvnp.ContentDocumentLinkTrigger: System.LimitException: Can only throw this exception type from VisualForce or Aura context
where in the code the trigger calls there are instances of e.g. AuraHandledException
thrown, but they are many classes away from the trigger. Also the errors are reported on content assets:
TYPE PROJECT PATH PROBLEM
───── ────────────────────────────────────────────────────────────── ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Error force-app/main/default/contentassets/homepagehero.asset cvnp.ContentDocumentLinkTrigger: System.LimitException: Can only throw this exception type from VisualForce or Aura context
Error force-app/main/default/contentassets/loginPageBackground.asset cvnp.ContentDocumentLinkTrigger: System.LimitException: Can only throw this exception type from VisualForce or Aura context
Error force-app/main/default/contentassets/logo.asset cvnp.ContentDocumentLinkTrigger: System.LimitException: Can only throw this exception type from VisualForce or Aura context
If you have experienced this error and have a fix let me know what the fix is. But seems like it might be a platform bug.
Trigger.isExecuting
guard in case that is enough to fix it and comment back.