[App server] java.lang.NullPointerException

This is great. Thanks for all the great works!

I have tried the latest App Server. Unfortunately it has java.lang.NullPointerException when I launch my app with --origin “https://mysite…”. Everything works fine if I downgrade to version 1.10.1. What else can I do?

In addition, I’m currently using the workaround mentioned in the post below to add credentials. Is there an official solution in the version v1.11.0?

1 Like

@stucork could you please help on this? Thanks!

I tried v1.12 and the issue is still there. The detailed error message is

[ERROR anvil.app-server.run] #error {
:cause nil
:via
[{:type java.lang.NullPointerException
:message nil
:at [java.io.File File.java 279]}]
:trace
[[java.io.File File.java 279]
[anvil.app_server.run$with_reverse_proxy_if_configured invokeStatic run.clj 284]
[anvil.app_server.run$with_reverse_proxy_if_configured invoke run.clj 242]
[anvil.app_server.run$_main invokeStatic run.clj 417]
[anvil.app_server.run$_main doInvoke run.clj 414]
[clojure.lang.RestFn applyTo RestFn.java 137]
[anvil.app_server.run main nil -1]]}

I have the same issue - have you found a solution yet?

No solution yet. I’m still using the old version which works fine. I have escalated it to Anvil team but no update yet.

@stucork any news on this? When I use the latest app, the app server version 1.12 works with http server but has the issue above with https server. The app server version 1.10.1 was working with https server but now has the error below. It means we don’t have any workable app server. Could you please help urgently? Thanks!

App Server v1.10.1 error with latest app
“Can’t construct a java object for tag:yaml.org,2002:value; exception=Class not found:”

There is an issue on GitHub on this problem as well:

HTTPS does not work in version 1.11.0 and 1.12.0 · Issue #88 · anvil-works/anvil-runtime (github.com)

Is there really no solution?

Hi all,

We have just released v1.12.1 of the App Server - please can you give it a try and let us know whether that resolves the issue?

Thanks!

Hi @daviesian,

I tried the v1.12.1 of the App Server. Now it has a different error as below.

Found Anvil App Server JAR in package directory
Launching HTTPS Server on port 443
Traefik dashboard: http://localhost:37707/dashboard/
[INFO anvil.app-server.postgres] Launching embedded Postgres database. Find Postgres daemon logs in the ’ .anvil-data ’ directory.
INFO[0000] Configuration loaded from flags.
2024/07/15 09:43:17 traefik.go:81: command anvil-traefik error: unable to initialize certificates resolver “letsEncrypt” with no storage location for the certificates
Reverse proxy exited with code 1
Runtime exiting. Shutting down Traefik.

We are also getting this error now with 1.12.1:

command anvil-traefik error: unable to initialize certificates resolver “letsEncrypt” with no storage location for the certificates

Any ideas?

Hi @huarong and @mfb,

Thanks for letting us know about this. We’ve just released v1.12.2 of the App Server, which should resolve these issues. Please could you give that one a try and let us know how you get on?

2 Likes

Thanks, with v1.12.2 the problem is solved.

1 Like

@daviesian We still have problem on v1.12.2 The server seems started. However, we always get the following error in the browser.

Assert failed: (-edn-roundtrip-ok? val val-str)

On the server side, the errors are

Calling function ‘route:/favicon.ico’ for app ‘FenticsFrontEnd’ (ID server-XQrN1pWCTczM6A==)
Single-use worker <anvil_downlink_host.full_python.worker.Worker object at 0x726a3ccdc790>
WARN[2024-07-16T11:03:39Z] A new release has been found: 3.1.0. Please consider updating.
Uncached worker <anvil_downlink_host.full_python.worker.Worker object at 0x726a3ccdc790> died; retired? False
Uncached worker <anvil_downlink_host.full_python.worker.Worker object at 0x726a3ccdc790> died; retired? False
Worker terminated for IDs set() (return code None) c5daeea865

Hi @huarong,

This looks like an unrelated error. Issues with edn-roundtrip-ok? are usually something to do with an invalid runtime session. Please can you confirm:

  1. That you don’t get this error when hosting a trivial sample app with v1.12.2 of the App Server
  2. That you still get this error when accessing your production app from a new session on a different device and in a different browser

That will help us narrow down the issue.

Thanks!

Thank you @daviesian

  1. I tried to host the example app “Expense Approval App” in the same environment and it seems working fine.

  2. I’ve refreshed my production app and the dependent apps and created a clean environment from scratch. I get the same error on my desktop and my phone. I tried another desktop and the error becomes “AppOfflineError: Connection to server failed (error)”.

Hi @huarong,

Thanks for these details. Please could you let me know the App ID (in the Anvil Editor) of the app you’re trying to host using the App Server? That should allow me to investigate the problem.

And one final point: When you try to access the app from another desktop and get the AppOfflineError, do you see any errors in the App Server output?

Thanks!

Thanks @daviesian. I have sent the App ID to you via email. There is no error / output in the App Server when another desktop get the AppOfflineError.

Hi @huarong

I’ve done my best to debug this, but your app is rather large and difficult to run. After working out the necessary dependencies and providing dummy values for secrets, I just end up in a login loop. If you’re able to provide a cut-down version of the app that demonstrates the problem, along with instructions for running it, then I’ll be happy to continue debugging!

Hi @daviesian

I’ve prepared two cut down versions of the original app,

Clone 1 (app id DDHZ3BDEAZ7HULRW): This has same issue (Assert failed: (-edn-roundtrip-ok? val val-str)) as the original app

Clone 2 (app id P3B77CMOL5UUOWLI): This one has no issue showing the first page in the browser.

Clone 1 and Clone 2 are essentially the same. I played around the dependent apps in Clone 2 and somehow the Assert failed error disappear, but the app server still have the error like

Calling function ‘wrapped_call’ for app ‘FenticsClone2’ (ID server-DxdSXvf3it0Oig==)
Single-use worker <anvil_downlink_host.full_python.worker.Worker object at 0x7cbd3c0fb010>
Uncached worker <anvil_downlink_host.full_python.worker.Worker object at 0x7cbd3c0fb010> died; retired? False
Uncached worker <anvil_downlink_host.full_python.worker.Worker object at 0x7cbd3c0fb010> died; retired? False
Worker terminated for IDs set() (return code -9) ae32bab032

Hope this is easier to debug. Thank you very much!

Hi @huarong,

Thanks for this, we will investigate these apps. Please can you confirm what steps are necessary in Clone 1 to cause the error?

Aside: That output from the App Server running Clone 2 is all fine - no errors there!