Scenario
Currently, my setup involves AppEngine Cloud Endpoints using a Bootstrap JavaScript UI along with a Google SQL Datastore.
Issue
The problem arises when the Javascript tries to call gapi.client.load and receives a 404 error. Surprisingly, the API Explorer functions correctly and the JavaScript works fine when tested locally... However, the failure occurs only when attempting to load the API via JavaScript.
This is the error message displayed in Chrome:
GET https://MyAppID.appspot.com/_ah/api/discovery/v1/apis/myAP…%2Cversion%2CrootUrl%2CservicePath%2Cresources%2Cparameters%2Cmethods&pp=0 404 ()
zu @ cb=gapi.loaded_0:83
n @ cb=gapi.loaded_0:83C
u @ cb=gapi.loaded_0:83
(anonymous function) @ cb=gapi.loaded_0:84
g @ cb=gapi.loaded_0:55
c @ cb=gapi.loaded_0:46
Additionally, it leads to another exception of "Cannot read property" due to the inability to locate the method within the unloaded API.
Code
The snippet from my index.html page:
function init()
{
apisToLoad = 2;
var callback = function()
{
if (--apisToLoad == 0)
{
signin(true, userAuthed);
}
}
gapi.client.load('oauth2', 'v2', callback);
//LOCALCHANGE (SWITCH BETWEEN LOCAL AND NOT)
gapi.client.load('myAPI', 'v1', callback, 'https://MyAppId.appspot.com/_ah/api');
//gapi.client.load('myAPI', 'v1', callback, 'http://localhost:8080/_ah/api');
}
To ensure all aspects are covered, I am including my appengine.xml as well:
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>MyAppID</application>
<version>1</version>
<threadsafe>true</threadsafe>
<use-google-connector-j>true</use-google-connector-j>
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
</appengine-web-app>
and my web.xml content:
<?xml version="1.0" encoding="utf-8" standalone="no"?><web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<servlet-name>SystemServiceServlet</servlet-name>
<servlet-class>com.google.api.server.spi.SystemServiceServlet</servlet-class>
<init-param>
<param-name>services</param-name>
<param-value>com.lthoi.myAPI</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>SystemServiceServlet</servlet-name>
<url-pattern>/_ah/spi/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
If there are any other potential locations where the error might be hiding, feel free to suggest further examination or provide additional files for review.