Registration with Endpoints Server...FAILED! (emulator worked, phone doesn't) - google-app-engine

Code generated by Android Studio>tools>Google Cloud Tools> Generate App Engine Backend
and Generate Endpoint worked in the Emulator,
Intent intent = new Intent(this, RegisterActivity.class);
startActivity(intent);
however I got this error (image from another person's question)
http://i.stack.imgur.com/230G2.png
when I load the app onto my phone and run. (I did change the LOCAL_ANDROID_RUN to false)
The error implies that there is some Endpoint server running at http://10.0.2.2:8080
which I don't expect because I don't really understand where the Endpoint Service runs. Does it run locally on the phone or somewhere on the Cloud?
I believe generated App Engine code is shipped up to Google through the Maven appengine:update
What am I missing here, thanks
-a
UPDATE (11:24 AM)
executed:
Android Studio>tools>Google Cloud Tools> Generate Client Libraries
which added to -AppEngine/target/generated-sources/appengine-endpoints etc
This changed what happened on the phone. There is still a registration error but now says:
2) registration with Endpoints Server...FAILED!
Unable to register your device with your Cloud Endpoints server running at https://.appspot.com/_ah/api
UPDATE (11:44 AM)
executed maven script
appengine:update to get the AppEngine deployed with the new code from Generate Client Libraries
same error on phone (unable to register your device with your Cloud Endpoints server)
UPDATE (1:39 pm)
got logcat info while running app on the phone, hooked up through USB to computer,
looks like a 404 Not Found error (???)
12-27 13:36:51.942 609-703/? I/InputDispatcher﹕ Delivering touch to: action: 0x1
12-27 13:36:52.412 19103-19103/sic.example.db7 W/AbstractGoogleClient﹕ Application name is not set. Call Builder#setApplicationName.
12-27 13:36:52.412 19103-19246/sic.example.db7 E/GCMRegistrar﹕ internal error: retry receiver class not set yet
12-27 13:36:53.253 19103-19246/sic.example.db7 E/sic.example.db7.GCMIntentService﹕ Exception received when attempting to register with server at https://core-phoenix-441.appspot.com/_ah/api/
com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found
Not Found
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:111)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:38)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:312)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1042)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
at sic.example.db7.GCMIntentService.onRegistered(GCMIntentService.java:158)
at com.google.android.gcm.GCMBaseIntentService.handleRegistration(GCMBaseIntentService.java:296)
at com.google.android.gcm.GCMBaseIntentService.onHandleIntent(GCMBaseIntentService.java:197)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.os.HandlerThread.run(HandlerThread.java:61)

the emulator can access because it runs locally, your phone doesn't have access to the computer localhost. To do that you can check Codiak answer.
https://stackoverflow.com/a/16097253/1368396

Related

SignalR IIS With React - "Server returned handshake error: Handshake was canceled."

I am developing a .Net Core (3.1) web application hosted with IIS 10. When I am trying to use SignalR on localhost, I am able to connect totally fine and receive messages from the backend, but after I publish it to IIS, I get the error: "Server returned handshake error: Handshake was canceled." In the client logs on Chrome's console, I get the message: "Information: SSE connected to http://myserver.com/MyApplication/output" before I get the error described above (which you would think means that I connected successfully)...
I have seen other posts where people have suggested that I have to enable webSockets on IIS, and I have already checked the my site has this enabled.
I have also seen people suggest to try using the longPolling argument in the withUrl function when creating the connection, and this has not helped either.
I have also added SignalR Event Log Trace Listeners to my web.config file, and the only warning I get that might be related to this issue is that I get a warning from the .NET runtime that reads "Failed to determine the https port for redirect." I am not sure what this means or if it would be related to SignalR, but as this also appears to deal with Middleware, it might be significant.
One thing that I thought might be related is that my site is just one of multiple hosted on this server, so that when I am running locally, I can use the following to connect to SignalR:
hubConnection = new signalR.HubConnectionBuilder().withUrl("/output").build();
But because of the way this site is deployed on my server, I have to use this:
hubConnection = new signalR.HubConnectionBuilder().withUrl("/MyApplication/output").build();
when I deploy the site or else I get a 404 error...
Would there be any issue there? I noticed when inspecting the network requests that on localhost, the URL to connect with the socket is "wss://localhost:44315/output?id=..." and I get the "Status Code: 101 Switching Protocols", but after I deploy, the url that is used is "http://myserver.com/MyApplication/output?id=..." and I get a "200 OK" just before receiving the error described at the top. Why does wss get used on localhost but http is requested from my client when I deploy?
FINALLY discovered the issue after days of debugging... The reason I was getting a "101" response on localhost and not when published is because 101 is basically the server (IIS in my case) saying "I support web sockets". I realized that because I wasn't getting this when published, web sockets were probably not enabled in IIS. It was weird, however, because I went into IIS manager and it said that web sockets were enabled, but after much more research, I found that you also have to go into "Server Manager" and enable it as well (see here https://learn.microsoft.com/en-us/iis/get-started/whats-new-in-iis-8/iis-80-websocket-protocol-support and follow step by step instructions). I did not realize both were required.

Not able to create the file on Google Cloud Storage

I am following the below link.
https://github.com/GoogleCloudPlatform/getting-started-java/tree/master/bookshelf-standard/3-binary-data
I create a new Google Cloud Project and followed the above instructions and all fine on the remote server
I tried using an existing old appengine project (created 4-5 years ago). I get the following error at the given code:
"Caller does not have storage.objects.create access to bucket ..."
storage.create(BlobInfo.newBuilder(bucketName, fileName)
// Modify access list to allow all users with link to read file
.setAcl(new ArrayList<>(Arrays.asList(Acl.of(User.ofAllUsers(),
Role.READER)))).build(),
fileStream.openStream());
Following is the stacktrace
Uncaught exception from servlet
com.google.cloud.storage.StorageException: Caller does not have storage.objects.create access to bucket asw12.
at com.google.cloud.storage.spi.v1.HttpStorageRpc.translate(HttpStorageRpc.java:189)
at com.google.cloud.storage.spi.v1.HttpStorageRpc.create(HttpStorageRpc.java:240)
at com.google.cloud.storage.StorageImpl$3.call(StorageImpl.java:151)
at com.google.cloud.storage.StorageImpl$3.call(StorageImpl.java:148)
at com.google.api.gax.retrying.DirectRetryingExecutor.submit(DirectRetryingExecutor.java:94)
at com.google.cloud.RetryHelper.runWithRetries(RetryHelper.java:54)
at com.google.cloud.storage.StorageImpl.create(StorageImpl.java:148)
at com.google.cloud.storage.StorageImpl.create(StorageImpl.java:141)
at com.example.getstarted.util.CloudStorageHelper.uploadFile(CloudStorageHelper.java:65)
at com.example.getstarted.basicactions.CreateBookServlet.doPost(CreateBookServlet.java:70
I checked up the Google Service Accounts in my old project and it exists. How do I know, who is the 'Caller'?
If you use the google-cloud libraries from App Engine and don't otherwise specify, you will be acting as your project's app engine default service account. Its name is probably something like your-project-id#appspot.gserviceaccount.com.
To get the service account name, open the Service Accounts page in the console, or check the settings on your App Engine page.

Google App Engine - Console Output

I am running a Java Microengine on GAE.
I have my own html pages for data input and output. When there is a data error and the engine cannot complete its execution (crashes) - the microengine spits out the "Response" as Server not available, please try later.
In order to debug, I run the dataset in the dev environment - as a Java application to identify the error in the console output.
Is there a way to capture the "error" (the console output equivalent when run as a Java application) - as an output string and send it as a content of the servlet response from the deployed Application in GAE..
thanks,
assuming you are using App Engine Managed VM, and a logging framework, you should also forward the log entry into a file, e.g. /var/log/app_engine/custom_logs/app.log
https://cloud.google.com/appengine/docs/managed-vms/custom-runtimes#logging
Subsequently, you'll be able to read the output from Google Cloud Logging.

Server Error in appspot.com application

Running my application on local with dev_appserver for finding event list from Google calendar and it works fine.
when I deployed through app-engine (deployment done successful) and when I run the file it gives me below error
Error: Server Error
The server encountered an error and could not complete your request.
If the problem persists, please report your problem and mention this error message and the query that caused it.
Google lot about this error still unable to find solution for the same
my app.yaml file structure.
- url: /calendar
script: webserverflow12.py
When I run this appspot.com/calendar. It is giving me mentioned error.
Any idea what changes need to do to run my application on live?
I feel that you didn't changed your client id and client secret which u registered for appspot.com domain when deploying to appengine server. So you are getting this error.
Check your application logs from your GAE admin page.
Hopefully you'll find some info there to help debug.

WCF error with hosting of a SL4 Navigation application

I have a SL navigation application, that currently runs on a shared hosting package with a 3rd party ISP. I can login, and register using the ASP.NET membership and role providers.
I have now setup a dedicated server, on which only my app will run. It does not yet have a domain name that points to it... I access it via an IP address.
I've copied the entire site (including the ClientBin and all the XAP's) to the new server, but the Authentication and Registration services don't work... they just return NotFound.
When I check Fiddler on the working site, this service is called :
www.myaddress.com/ClientBin/MyApp-Web-AuthenticationService.svc/binary/Login
which of course succeeds. However, on the other site, the fiddler trace looks the same (because I just copied the site) :
123.123.123.123/ClientBin/MyApp-Web-AuthenticationService.svc/binary/Login
but, the call fails with NotFound. Fiddler reports it as HTTP/1.1 500 Internal Server Error. When I open
http://localhost/ClientBin/MyApp-Web-AuthenticationService.svc/binary/Login
on the server, I get the HTTP/1.1 500, as well as this description :
Handler "svc-Integrated" has a bad module "ManagedPipelineHandler" in its module list
Which leads me to believe that there is something wrong with my IIS config, as the exact same code is working on another system.
What is a "bad module"? How do I fix it?
Normally this type of error is that ASP.Net is not activated or that a handler for svc is not registered or registered correctly.
In your case is looks a bit different. It could be that you have .net framework 4.0 code that you are trying to run in a .net framework 2.0 application pool.
IIS 500 errors often show up with more information in the Windows Event log - if you can somehow get access to that?
Also I've noticed that often the server will actually send debugging output back to the client that everything seems to ignore. Have you checked the entire raw response that is coming back from the server to see if there are any clues there?

Resources