Failed to install app error for custom app built with App Platform

Copy: @mediremi @varl @phil

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?

How can I work around this?

Hi @jetisco4u,

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?

Kind regards,
Phil

@phil thanks. I tried to install in a local instance. Same when I try to install in a production environment. Both run on 2.38.1.1 patch version

EDITED
I just try now on play and it show the same error Failed to load resource: the server responded with a status of 409 ()

@phil I am using React 18 in my App, can it make it fail to import? Because I saw in the app platform package.json that we can you ^16* version.

@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.

1 Like

@austin How can I share the zip

@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)

1 Like

@austin Here is a link to the repo GitHub - jetro4u/dcap

The console error says Failed to load resource: the server responded with a status of 409 ()

I added the zip. Infact I have created about 3 variations but still get the same error.

1 Like

Hi @jetisco4u ,

One thing I observed is, you do not have a d2.config.js file. Instead you have d2.config.json file.

This could be the reason for your app failure.

Thanks,
Rithvik

I actually have d2.config.js in the root of the project. But after building the folder I guess the cli generate the .json

@jetisco4u ,

Looks like you have pushed the build output instead of the code base in github :smiley:

Thanks,
Rithvik

I rebuild the app again and can confirm that d2.config.js was changed to d2.config.json after build

@jetisco4u ,

Found the error :smiley:

Please remove “developer”: “Webclick” line from manfest.webapp

This should solve your issue.

Thanks,
Rithvik

2 Likes

@rithvik you are on point. Imagine I have had to develop 3 variations of the App. I am on the fourth one to simplify further. Big thanks!

1 Like

@jetisco4u ,

Glad it worked :slight_smile:

I’m just adding the steps I have followed to debug this to help others :slight_smile:

  • 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"])

Thanks,
Rithvik

2 Likes

Thanks! :slight_smile:

1 Like

@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.

2 Likes

@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.

@jetisco4u ,

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?

Thanks,
Rithvik

@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.