Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gs999918 opened this issue May 3, 2021 · 2 comments
Open

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

gs999918 opened this issue May 3, 2021 · 2 comments

Comments

@gs999918
Copy link

gs999918 commented May 3, 2021

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
Copy link
Author

gs999918 commented May 3, 2021

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
Copy link
Owner

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants