Time to time I am getting an undefined error when a few of JS scripts (static resources) are loaded. The error is faced only the first time the component is loaded. It means, after the error is faced if the component is closed and the page is refreshed then,the next time is working perfectly.

This is the piece of code:

    renderedCallback() {

    if (this.fullCalendarJsInitialised) {
    this.fullCalendarJsInitialised = true;

        loadScript(this, FullCalendarJS + '/jquery.min.js'),
        loadScript(this, FullCalendarJS + '/moment.min.js'),
        loadScript(this, FullCalendarJS + '/theme.js'),
        loadScript(this, FullCalendarJS + '/fullcalendar.min.js'),
        loadStyle(this, FullCalendarJS + '/fullcalendar.min.css'),
        .then(() => {

        .catch(error => {
                message: 'Error occured on FullCalendarJS',


This is what the browser's console is shown when the error is faced, as we can see the console error message is printed, but at the same time, all the scripts appears with the status code 200...Does this make sense??

enter image description here

Any idea?

Note: Disabling the cache in the browser’s console** the error appears time to time** during the first time load, so it is not easy to replicate.

  • Hi, I am having similar problem. Did you resolve it ? Nov 14, 2022 at 17:37
  • 1
    I am having this same problem with FullCalendarJS. Did you ever figure it out?
    – mike537
    Feb 15, 2023 at 23:39

2 Answers 2


You are loading the scripts from the renderedCallback, since you haven't shared the whole component I can't be sure but I suspect you try to use something from those scripts before they are loaded.

You might want to set a second scriptsLoaded variable in your then handler and hold off on using those libraries until it is set.

  • There a two components, a parent an a child, child methods are only executed when a button in the parent is clicked. In this case, the loadscript error is faced when the component is rendered, so the user didn’t have time to click any button yet. Dec 17, 2021 at 21:18

My issue (not with ChartJS which was working fine, but with PptxGen JS) was resolved by enabling Lightning Web Security (LWS).


Thank you Dmitry Bakovich 7!!


You must log in to answer this question.

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