I am using the app management to manually install app I built with the app platform. Its a basic app more like a reclone of the d2 scripts init app. When I upload the app using the app management custom app upload, I am getting error Failed to install app. When I check console it seems the app can not resolve the baseUrl. When designing app, is there somewhere where the baseUrl is set?
I don’t think you should need to set a baseUrl in the app itself, as it should be possible to install it on any instance; but @birkbjo or, @austin can probably confirm that.
Where have you tried installing the app? Which version of DHIS2? Have you tried to install on one of the instances on our play instances?
@jetisco4u can you please share the .zip file or source of the app you are trying to upload? And can you share the exact error you are seeing related to baseUrl in the console? Neither React version nor baseUrl should have any impact on the installation of an app in the App Management upload interface, but some other misconfiguration in the application manifest could cause this.
@jetisco4u if you can upload the .zip file somewhere you can share a link here. You can also create a free GitHub repository to share the source code which reproduces the problem (just make sure to remove any sensitive code or data, if there is any, before uploading)
I’m just adding the steps I have followed to debug this to help others
I have installed the app in my local instance (created using d2 cli) running on “http://localhost:8080”
Once I got the error in the UI, I had to check the application logs.
To check the application logs in this setup, 1st run “docker ps” command. This command will display all the running containers. Check the one using “dhis2/core:{dhis_version}” image. Copy the container ID of that container
Run “docker logs -f container-id”, to get the application logs.
Error msg for above issue
ERROR 2022-09-12T14:15:03,551 Failed to install app: Could not save app (JCloudsAppStorageService.java [http-nio-8080-exec-7]) ID4B6l1sR522CWg2vAiUVOP2hQPrwMKNITjE0UO+jYEYM=
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `org.hisp.dhis.appmanager.AppDeveloper` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('Webclick')
at [Source: (ZipFileInflaterInputStream); line: 23, column: 16] (through reference chain: org.hisp.dhis.appmanager.App["developer"])
@rithvik thanks this is even more helpful. Funny enough I do this all day to debug for docker error and instance error only. Never thought of using it to debug for frontend error.
@rithvik please what do you think about this. I have an instance running in a custom docker container. Later I deploy another instance into a virtual hosting platform in a domain. when I tried to connect to the virtual instance from a localhost app, I was getting error the error api.js:4 Fetch failed loading: GET "https://mydomain.org/api/system/info".. Since the system cannot fetch the system info I cannot login. So I go back to using my localhost instance but it has been showing error 404. Before I proceed to debug I want to find out if I can have a localhost instance and another instance running in a virtual server on port 8080 on my system.
Actually I didn’t get the gist of your question. As you are having issues connecting to remote server when developing the app, you want to use the local server on your machine?
@rithvik yes. But the local server stop connecting and start showing error 404. So I wanted to find out whether its because I deploy to the remote server and there is some kind of conflict in the port. If not I can try to debug why the localhost is showing error.