If clean urls are enabled, the drupalgap status check at admin/config/drupalgap fails with the error:

Not found: Could not find the controller.
NaN

Comments

tyler.frankenstein’s picture

Status: Active » Needs review

I'm not able to reproduce this. I just updated to Services 3.5 on a site with clean URLs enabled, and the System Connect test at admin/config/drupalgap works fine. Be sure you've updated to at least Services 3.4 or the System Connect will definitely fail.

Also, if you watch the 'Network' tab in the console, the DrupalGap System Connect token retrieval and subsequent test, both use ?q= regardless if clean URLs are enabled or not.

tyler.frankenstein’s picture

Title: Status Check fails on clean urls enabled » System Connect Status Check Fails

I just saw this error on a client's site. At first I thought it might be the site conflicting with the Boost module, so I tried the troubleshooting technique for boost. That didn't work though. I then tried enabling/disabling clean URLs and that also resulted in the same error:

Not found: Could not find the controller.
NaN
tyler.frankenstein’s picture

I received this same error on another client site. This time it was because of the Global Redirect module. Disabling the 'Non-clean to Clean' to checkbox at admin/config/system/globalredirect allows DrupalGap to work with Global Redirect.

tyler.frankenstein’s picture

Issue summary: View changes
Status: Needs review » Closed (fixed)

Resolved with the 7.x-1.5 release of the module.

vladbo’s picture

Status: Closed (fixed) » Needs work

The same error appears with more than 2 languages(language prefix in the url). Disabling the 'Non-clean to Clean' checkbox in Global Redirect doesn't fix it.

tyler.frankenstein’s picture

Status: Needs work » Postponed (maintainer needs more info)

@Vlad Bo, will you please tell me a bit more about your multi lingual setup? i.e. what is the URL on your site where this error occurs? I'm curious to see how the language codes appear in the URL, and how that may be causing an issue.

davewilkinson’s picture

This appears to still be an issue on the dev version - if non-clean to clean is turned on, the service won't connect. With it turned off, it connects immediately. I'm not running a multi-language install.

tyler.frankenstein’s picture

@davewilkinson, if you go here:

admin/config/search/clean-urls

The "Enable clean URLs " check box is checked, it does not work, but if you uncheck it, it does work?

Please confirm, thanks.

UPDATE: Nevermind @davewilkinson, I see this is related to the Global Redirect module.

AndreaD’s picture

I have just clean installed a 7.29 and updated to 7.30 Drupal core, with DrupalGap 7.x-1.6. And got the same error. I have disabled clean URLs, and it didn't helped either. Is there any other solutions / suggestions I could try?

tyler.frankenstein’s picture

@AndreaD, do you have any of the conflicting modules installed on your site? https://www.drupal.org/node/2015065

AndreaD’s picture

@tyler.frankenstein No any of those. It is a totally clean Acquia install, only with the purpose of testing the DrupalGap module, and possibilities ;)
If you would like I can pm you a link + a user with all access.

AndreaD’s picture

@tyler.frankenstein Also the admin/structure/services/list/drupalgap/resources is showing a blank screen....

& the poster plugin throws a 500 - Internal Server Error. Unfortunately I can not understand where I should look for any further error messages for helping me in the right direction.

tyler.frankenstein’s picture

I would try disabling and uninstalling the DrupalGap module. Then have only the Services module installed, then try to visit Admin -> Structure -> Services and see if you can set up a custom service endpoint. Then try to use FireFox Poster to make a System Connect call to that service endpoint.

Feel free to PM me that site info, and I shall take a look.

AndreaD’s picture

After I have uninstalled DrupalGap I have created a service where I could get it to send a 200 message. (I have thought needed to edit the services.test file according to this: http://drupal.stackexchange.com/questions/78841/drupal-7-services-rest-403 I have added Content-Length = 0. )
After this was working I have installed DrupalGap again. This again gives me 500, and my test-service now throws a 404.

tyler.frankenstein’s picture

Try installing the dev snapshot of the DrupalGap module. Also, I would recommend contacting Acquia and asking what their CORS policy is. Other folks have ran into problems with their host having a strict CORS policy which prevent DrupalGap from functioning properly.

AndreaD’s picture

I have made a fresh install without using Acquia or Drush. I have installed the dev snapshot and it was not making any difference. I have used my test server with bluehost - on a shared account. I have also contacted them - they don't know ANYTHING about their CORS policy. (I have been sent back and forth and they don't even knew what I was talking about...)
So I think the problem very easily could be the hosting provider.

What hosting provider do you have, where it works?

tyler.frankenstein’s picture

I prefer Site5 for shared, reseller, and VPS hosting. They have Drush and GIT pre-installed on each account, so it is an excellent set up for Drupal folks.

Have you tried a localhost environment?

AndreaD’s picture

I have been struggling with Bluehost for some days. I have now created a testing account with Site5, thank you for the tip ;) And the whole stuff - of course - works :)Thank you for your time & fast support!

tyler.frankenstein’s picture

Status: Postponed (maintainer needs more info) » Needs work

@AndreaD, thank you for following up. I am glad it is now working. Unfortunately some hosts do not play nicely with DrupalGap+Services, so it can be difficult to debug.

@davewilkinson, are you still having problems? I just started on a DrupalGap project for a multi lingual site, and am having the same problem on the system connect page. However, I think it is related to some conflicting module(s). Most conflicting modules tend to be ones that offer advanced caching, and/or url+path redirection. My technique will be to disable (and possibly uninstall) potential culprit modules and report back here.

Any other debug information would be very helpful, so please share, thanks!

tyler.frankenstein’s picture

Status: Needs work » Closed (works as designed)

Today with a multi lingual site, I ran into this error when visiting admin/config/drupalgap (which will soon become admin/config/services/drupalgap, FYI):

System connect failed!
NaN

This was hapenning because of the Global Redirect module. Disabling the Global Redirect module resolved the issue (I did not have to uninstall Global Redirect).

At first, I thought it may be because DrupalGap is not prefixing the language code to the Service request URLs, but once I disabled Global Redirect that fixed the problem.

I noticed a few other modules that may conflict with DrupalGap (but did not conflict with DrupalGap on this particular site), and that is:

  • Translation redirect (i18n_redirect)
  • Redirect (redirect)

It sure would be nice if Global Redirect would allow us to ignore any request to ?q=drupalgap/*

#1438584: Disable Global Redirect on certain paths

UPDATE: This patch fixes the problem with Global Redirect. After patching, go to admin/config/system/globalredirect and set drupalgap/* as a path to ignore.

davewilkinson’s picture

Confirmed that the patch #20 works for me.