Guidance for diagnosing {"message":"An error has occurred."} - azure-mobile-services

Can someone point me in the direction of instructions for working out what has gone wrong with my Mobile Service App. It was working fine with a couple of simple tables. I then extended the data model using code first and migrations and now all I get when enter a url such as:
http://xxxxxxxx.azurewebsites.net/tables/firm?ZUMO-API-VERSION=2.0.0
is
{"message":"An error has occurred."}
I have now removed all new tables/data objects and controllers so that only one exists for a single table called "Firm" which has a single string property. I have switch OFF authentication/authorization in the Azure portal but I still get the same error.
I have tried both CustomErrors=Off and CustomErrors=RemoteOnly in the debug web config. I am publishing a debug build.
I have tried switching on logging and remote debugging etc in Azure but am unable to work out what is broken. I have tried remote debugging with a break point in my FirmController GetAllFirms method but error occurs before that point.
How do I get more useful information about what the problem is?

I have managed to solve this one myself. In fact now that I know what it is the answer was staring at me from the build output.
The issue was that when extending my model I referenced a .NET Standard 2.0 class library containing some enum definitions that are common to both the backend and the client.
I did not notice the warning that some assembly versions needed binding redirects added to web config. Double click on the warning message and VS2017 will add the necessary entries to web.config for you.
For more details see here on github.
I never did manage to get behind the {"message":"An error has occurred."} though. I solved this by rebuilding my backend project one step at a time and it was after adding the reference to the .NET standard project than I noticed the "Consider app.config remapping of assembly ..." messages in the build output window.

Related

Getting started with Azure Spatial Anchors: CreateAzureAnchor() crash or taking a long time to load

I have been following this tutorial:
https://learn.microsoft.com/en-us/windows/mixed-reality/develop/unity/tutorials/mr-learning-asa-02
there were some necessary configurations and steps not included in the tutorial like:
it needed an ARCameraManager error log
it needed an ARSession error log
it needed an ARAnchorManager error log
which I configured as I keep getting errors and fixing it along the way
and was able to deploy, test and follow the in-device tutorial:
Move the cube to a different location
Start Azure Session
Create Azure Anchor (creates an anchor at the location of the cube).
......
but I got stuck in #3
when I tap for create Azure button, it just crash but when I check the Debug version, it didn't actually crash cause there were no actual errors, I think it just keeps loading and/or working on the current main thread because everything disappeared when I tap the create Azure Button.
I check the codes of its corresponding function and this is it:
as you may notice it has an error, this is the actual script from the package I download, but all I had to do to fix this is add ".Result" after ".GetPointer()"
I divided the script and added logs so I can see which part is the problem:
the very last to log is: "tastInpt" which means getting the result is the problem.
is this fixable? can anyone help me get through this?
Could you provide little more info about your environment? For example, Unity version, Azure Spatial Anchors (ASA) SDK version and OS version of your HoloLens 2 device.
Are you using the matching ASA SDK for your Unity? In the tutorial you mentioned above has a link to this page: https://learn.microsoft.com/en-us/azure/spatial-anchors/how-tos/setup-unity-project?tabs=unity-package-web-ui
Some common mistakes includes the version mismatch - Unity 2019 requires ASA SDK 2.7 or above and below 2.9, and Unity 2020 requires min version of 2.9.
Was able to fix this on my own by using this:
a github repository of Azure samples. I actually don't know why this worked but the samples from Microsoft didn't. but here you go:
https://github.com/Azure/azure-spatial-anchors-samples
I just realize my fix for that error:
gameObject.GetComponent<UnityEngine.XR.WSA.WorldAnchor>().SetNativeSpatialAnchorPtr(currentCloudAnchor.LocalAnchor);
is just to comment it out since I thought this won't be necessary, because I was yet to start development and as I understand (from reading the code) that this is just for loading the anchor not creating it, but I might be wrong. but anyway It's one of the things we must fix also in order to load. or create(if this does indeed help with the create anchor feature)
again this script is from:
MRTK.HoloLens2.Unity.Tutorials.Assets.AzureSpatialAnchors.2.5.3.unitypackage

how to identify broken binding using UI5 diagnostics

Step 30: Debugging Tools of the UI5 documentation introduces the diagnostics, which can be accessed through the ctrl-alt-shift-S keycombo.
After deliberately inserting an error in a path, I've tried navigating to the binding info in the control tree as instructed:
I'm supposed to be able to see that the binding path of the number attribute is marked as invalid
It cannot possibly rely on me spotting the typo because that would imply already knowing what the error is in the first place.
Can anybody explain how exactly I should do that?
Additionally:
Chrome 84.0 or Firefox 79.0, same results.
tried the online version from the official demo kit as well as my own localhost copy
The fix is now in the master branch of UI5. If you run the downloaded sample with
https://openui5nightly.hana.ondemand.com/resources/sap-ui-core.js, we can see the invalid binding path indication:
ExTendedPrice (invalid)

How to add logging to an existing Eclipse plugin to work in 2019-12?

I'm trying to fix a problem in an Eclipse plugin at https://github.com/davidmichaelkarr/e4macs . The repo is a fork of the original application, which is now abandonware.
I have a couple problems with this, but I'm going to limit the scope of the question, hopefully making it simpler for someone to provide an answer.
The main problem I'm having with the plugin is that some operations (the operation "split-window-vertically" in particular) simply do nothing when I execute them. This didn't used to be the case. In some recent versions of Eclipse, this was working fine. It stopped working about 2019-09.
What I want to do first is add log statements that show it's at least getting to the handler method. I've concluded that I don't know how to add logging to an Eclipse plugin. The existing code for the plugin doesn't do any logging, so I don't have an example to go by. I've searched the net for documentation on how to do this, but all the articles I've found are either incomplete or just don't work.
I know of at least one handler that IS working properly. I added what I thought was the correct logging code to that handler, and it never appeared in the ".metadata/.log" file, so I assume that that was not the correct way to do logging.
I saw a reference to using "Activator.getDefault()", but that posting didn't say what the FQCN is, and all the completion offerings I found didn't have a "getDefault()" method.
Update:
I added something like the following to two classes:
private ILog logger = Platform.getLog(<ContainingClass>.class);
And then in a method in each of these classes, I used logger.info("message");
I ran this in my debug instance and tested the operations in both classes. The log messages appeared.
I then uninstalled the plugin from the main installation, then built the plugin in my RPC instance, then reinstalled the plugin in the main installation, from the local update site defined by the "...Update" project.
I then tested both operations, and I saw nothing in the log.
I may have solved my logging problem at this point, but I'm still having some sort of problem with deployment. I have a feeling that the process I went through to reinstall the changed plugin is not working.
To get an activator with a getDefault() method you must specify that the plugin contributes to the UI when you create it and that you want an Activator to be created. This should create an activator class extending AbstractUIPlugin and with a getDefault() static method.
In any plugin you can always use:
IStatus status = new Status(....);
ILog log = Platform.getLog(getClass());
log.log(status);
to log a status object.
Status has numerous constructors. A simple one just to log a message is:
new Status(IStatus.INFO, "plugin id", "message");
Platform is org.eclipse.core.runtime.Platform
Status is org.eclipse.core.runtime.Status

Accidentally published CompositeC1 with precompile on

I accidentally published Composite C1 from Visual Studio with "Precompile during publishing" when I first set it up and have now come to realize that several plugins do not work with precompile turned on. Unfortunately I have no idea how to reverse this. I've tried several things to no avail. I usually end up with a 500.0 error. If I go to the admin interface everything is working properly, and I can even preview the pages, but from the customer side all I get is a 500.0 error.
Of course I could republish from the Visual Studio project I have, but that project has the default template on it. I've tried copying what appears to be changed on the server to the original project but I end up with a 500 error. I've tried removing all the precompiled stuff on the server but I end up with a 500 error. I'm pretty lost.
At this point I'm willing to do anything. Is there a doc explaining how to copy the content to a newly downloaded copy, kind of like an upgrade doc but "side-grading"? I am using the most current version at the time of writing this 4.2 Update 1
Thank you
Solved use the PackageCreator suggested by wysocki's answer. It was not exactly straight forward to create the package. The errors can very cryptic at times. So here are some of the issues I encountered and how I got past them:
wysocki was correct to suggesting starting with a bare bones installation even though my original project was started with the Venus theme. I tried both ways.
I encountered issues with the MasterLayout and the Page Template Features which are currently not supported by the PackageCreator, although they may be supported in future versions. The solution was to add the missing elements to the fresh C1 project from the original C1 installation in the App_Data/PageTemplates and App_Data/PageTemplateFeatures folders.
A few times I ran into an issue where I added the same page or function twice to the PackageCreator. This was obviously my fault, but it should be mentioned that you can add the same site element twice which throws and error on import. Make sure you are careful to only getting one of each when creating the package to be exported.
If you are getting and error and it uses and Id like "4061397b-ee9e-4512-984d-f2b2d41eb654" I've found that it was very helpful to extract the zip file you are trying to import and then search the extracted folders for that Id. The lines with the Id usually have more information on them that will help you to identify exactly what content page or whatever the error is being generated from.
If you are using installed packages in your project like SimpleSearch for example, make sure you don't add it's functions to the PackageCreator. Install them separately.
I had an issue where I somehow had an element in the Data section that didn't have a "type". The error simply "The type cannot be empty". This was obviously tough to find so I suppose the lesson is, less is more. If you think your project might have a few elements that are unnecessary, don't add them at first and see if the project you import them into complains about missing them. It's much easier to troubleshoot missing elements than it is to figure out which element is causing the issue that you really didn't need.
Is there a doc explaining how to copy the content to a newly downloaded copy
You can try and export content / templates / anything else related to a "package" via Composite.Tools.PackageCreator.
Its latest version gives you quite a lot of flexibility in what you can export ("package") - please its user manual.
Once the package is made and downloaded, you can go on and install it on a new website. If you export / import a lot of content / templates etc, it makes sense to have a "Bare Bones" site as the new one.
All the starter sites like "Neptune", "Venus" are installed as a bunch of packages in specific order during Composite C1's initial setup.

How to get Eclipselink samples to work: "student" and "mysports" samples

I've been trying to get the following Eclipselink samples to work, with less than 0% success:
A)
http://wiki.eclipse.org/EclipseLink/Examples/JPARS/Simple
B)
git://git.eclipse.org/gitroot/eclipselink/examples/mysports.git
Both samples are quite recent and should work "out of the box". My results:
A) starts and deploys on glassfish, but application is totally unresponsive
B) does not deploy, since glassfish does not find the data-source mentioned in the persistence xml's: java:global/mysports
For both I tried to get information on how they are supposed to work, but after two days of searching for documentation, I can safely state: there is literally NOTHING documented.
For A) I am totally clueless, there is nothing to configure for this sample, but the provided URLs for interacting with the REST service always return with 404 and no log or error message whatsoever.
For B) Beside the broken data source (I guess my fault), I tried setting default JDBC data-sources, to see if at least the REST service itself works: it looks dead, I get exceptions when opening the sample JSF pages (the reference variables inside the pages all resolve to NULL).
Anybody ever tried to actually run these samples? I am totally frustrated after many hours of being far away to anything testable...
Maybe some questions as a starting point:
- How does the JPA-RS get registered in the appserver? how do I tell if it was at all? And which URL it maps to?
- How does this magic "java:global/mysports" data source work?
- The maven configuration acts funny, I couldn't get any of the two samples to properly debug (no breakpoints were hit at any point in time). Any ideas?
If you are using Glassfish earlier than Glassfish 4.0 (http://dlc.sun.com.edgesuite.net/glassfish/4.0/promoted/) you will need to download newer version of EclipseLink 2.4.2 binaries from http://www.eclipse.org/eclipselink/downloads/nightly.php (2.4.2 Nightly Build Results) and replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above:
org.eclipse.persistence.antlr.jar
org.eclipse.persistence.jpa.jar
org.eclipse.persistence.asm.jar
org.eclipse.persistence.jpa.modelgen.jar
org.eclipse.persistence.core.jar
org.eclipse.persistence.oracle.jar
javax.persistence.jar
org.eclipse.persistence.dbws.jar
org.eclipse.persistence.jpa.jpql.jar
Make sure you clear Glassfish osgi cache by removing the $GLASSFISH_HOME\glassfish\domains\your_domain\osgi-cache directory after you replaced the bundles listed above, and before you restart the Glassfish.
These are both advanced examples, unless you are looking for these specific features, I would recommend starting out with simpler examples.
There are many EclipseLink JPA examples documented here,
http://wiki.eclipse.org/EclipseLink/Examples
Most of the examples are still in SVN here,
http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/
For documentation on the JPA-RS examples see,
http://wiki.eclipse.org/EclipseLink/Examples/JPA#JPA-RS
Try adding question to the example's wiki discussion page if you are having specific problems.
The MySports example is very advanced. Unless you are looking for extendable entities and multi-tenancy, I would not recommend starting with this example.
To add to James' comments, if you are specifically interested in JPA-RS, perhaps these additional comments will help. I also recommend asking questions on the wiki discussion page.
JPA-RS gets registered in the appserver by the existence of the org.eclipse.persistence.jpars_[version].jar in the WEB-INF/lib directory. This jar contains the web-fragment.xml which is what defines the JPA-RS service. You will know if it was deployed if the following URL pattern returns persistence unit metadata:
http://<server>:<port>/<applicationName>/persistence
Some additional documentation for JPA-RS:
- http://www.eclipse.org/eclipselink/documentation/2.4/solutions/restful_jpa001.htm
- wiki.eclipse.org/EclipseLink/Development/2.4.0/JPA-RS/REST-API
One thing that will help you debug is to view the Glassfish server log. If you are running in Eclipse, right click on your Glassfish server in the Server view, go to Glassfish->View Log File, which will open the server log in your console view. This will show you what is happening with deployment, and will alert you to any errors. Also be sure to double check your URLs.
Ok, ladies. A friend of mine had the brilliant idea of forcing ALL logging on eclipselink-jpars library (by setting this value in every single file we could think of) and indeed we found an exception that is FOR NO GOOD REASON hidden in the lowest log level:
javax.xml.bind.PropertyException: name: eclipselink.json.include-root value: false
Whatever that means, but that again convinces me that I will not use this feature/lib for the time being. An exception should be visible on all log levels, especially if I go down to FINE (as stated in the samples!)! I almost lost three days just because of this.