signalpoint / DrupalGap

An application development kit for Drupal websites.
https://www.drupalgap.org
GNU General Public License v2.0
232 stars 185 forks source link

DrupalGap 7.x CORS? Whitelist? Ajax call errors #1037

Open gs999918 opened 3 years ago

gs999918 commented 3 years ago

Aloha,

I am trying to keep my app alive, at this point. The modules are not loading on the Ajax call to load them, and instead throwing errors that they cannot be loaded. For your reference, below is the code snippet that is failing. This is for Cordova 10.0.0 cli and the corresponding iOS and Android versions that go with the new cli version.

Off the top of our heads, why would this be happening? --All sources point to the fact that this is a CORS or whitelist error. I know @signalpoint may have some advice, because he was working with DrupalGap on various live projects. Is this going to be the end of Drupalgap 7, or is this indeed something that can be configured with CORS and whitelist error resolution? Is anyone running into this issue? Just last DEC, 2020 everything was running fine on Cordova 9.0.0 and its corresponding iOS and Android versions. Any advice/comments would be welcome.

Thanks,

GS

 // Now load all the paths for this module.
            for (var modules_paths_index in modules_paths) {
                if (!modules_paths.hasOwnProperty(modules_paths_index)) { continue; }
                var modules_paths_object = modules_paths[modules_paths_index];
                jQuery.ajax({
                    async: false,
                    type: 'GET',
                    url: modules_paths_object,
                    data: null,
                    success: function() {
                      if (Drupal.settings.debug) { console.log(modules_paths_object); }
                    },
                    dataType: 'script',
                    error: function(xhr, textStatus, errorThrown) {
                      console.log(
                          t('Failed to load module!') + ' (' + module.name + ')',
                          textStatus,
                          errorThrown.message
                      );
                    }
                });
            }
        }
    }
gs999918 commented 3 years ago

Aloha,

Just to give you an update, the theme is not being loaded either, as well as blocks and regions--everything is throwing loading errors with the new version of cordova 10.0.0 and its corresponding Android and iOS version(s). This is pinpointed to JQuery.ajax calls somehow failing.

Thanks,

GS

signalpoint commented 3 years ago

@gs999918 I guess I would suggest including all of your custom modules and theme in the <head> of your project's index.html file. Then I'd modify DG7 core to skip its attempt at loading all the modules and theme over the jQuery ajax GET call. This should hopefully get you around this error.

With DG8 an on a D7 site, I had lots of CORS and Cookies issues to work through with iOS + Cordova 10.