I get this error on the bottom of the page when trying to show a toast message

This page has an error. You might just need to refresh it. Error in $A.getCallback() [$A.getEvt(...) is undefined] Callback failed: apex://StudentRegistrationController/ACTION$saveStudent Failing descriptor: {lightning:notificationsLibrary}

I did as the documentation stands for this:

Aura component:

<lightning:notificationsLibrary aura:id="notificationsLibrary"/>


if(state === "SUCCESS") { 
        "variant": "success",
        "title": "Contact Updated",
        "message": "Contact successfully updated"
        $A.getCallback(function() {
            window.location.href = "/";
        }), 3000
} else {

Won't work, even if I use:

var toastEvent = $A.get("e.force:showToast");
    "title": "Success!",
    "message": "The record has been updated successfully."

Happens the same.

Web console shows nothing, no error or warning.

What could it be? A bug from Salesforce maybe?

2 Answers 2


<lightning:notificationsLibrary> and force:showToast are both unsupported in the Lightning Out context, because they're handled by the Lightning Experience itself.

Note that the Component Library page for <lightning:notificationsLibrary> shows

Lightning Experience, Lightning Communities, Salesforce Mobile App

while force:showToast reads

This event is handled by the one.app container. It’s supported in Lightning Experience, Salesforce app, and Lightning communities.

You won't be able to make use of that built-in functionality without providing some implementation yourself.

  • Thank you David, one last question, which approach should I take to implement that? Thanks again
    – AjFmO
    Commented Apr 19, 2019 at 19:48
  • 1
    You'd need to be implementing whatever framework you want to use to display notifications, whether that looks like a Toast message or uses some other display mechanism. Paul's answer below has a link to how SLDS marks up notifications.
    – David Reed
    Commented Apr 20, 2019 at 12:02

Since this is one of the events not supported in Lightning Out, I would suggest adding some markup for the slds notification (https://www.lightningdesignsystem.com/components/notifications/) and have some conditional logic in the controller/helper which sets any messages then displays it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .