SMTP Settings in App-Server Not Working

Hello all, I’ve read the docs and previous entries but just can’t make this work. Trying to implement custom SMTP server with AWS SES on app-server deployed in Lightstail.

Have created config file, implements other aspects fine. But, when testing email functions such as password reset in the login form it throws:

at anvil.app_server.secrets$get_global_app_secret_value.invoke(secrets.clj:64)
at anvil.dispatcher.native_rpc_handlers.email$send_BANG_$fn__19228.invoke(email.clj:171)
at anvil.dispatcher.native_rpc_handlers.email$send_BANG_.invokeStatic(email.clj:171)
at anvil.dispatcher.native_rpc_handlers.email$send_BANG_.invoke(email.clj:80)
at anvil.dispatcher.native_rpc_handlers.users.core$send_email_BANG_.invokeStatic(core.clj:406)
at anvil.dispatcher.native_rpc_handlers.users.core$send_email_BANG_.invoke(core.clj:371)
at anvil.dispatcher.native_rpc_handlers.users.core$send_password_reset_email.invokeStatic(core.clj:496)
at anvil.dispatcher.native_rpc_handlers.users.core$send_password_reset_email.invoke(core.clj:481)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invokeStatic(core.clj:659)
at clojure.core$apply.invoke(core.clj:652)
at anvil.dispatcher.native_rpc_handlers.util$wrap_native_fn$fn__537$fn__540$fn__549.invoke(util.clj:83)
at anvil.dispatcher.native_rpc_handlers.util$wrap_native_fn$fn__537$fn__540.invoke(util.clj:82)
at clojure.lang.AFn.run(AFn.java:22)
at anvil.core.worker_pool$run_one_task_BANG_.invokeStatic(worker_pool.clj:48)
at anvil.core.worker_pool$run_one_task_BANG_.invoke(worker_pool.clj:32)
at anvil.core.worker_pool$launch_thread_BANG_$fn__5565.invoke(worker_pool.clj:86)
at clojure.lang.AFn.run(AFn.java:22)
at java.lang.Thread.run(Thread.java:748)
[ERROR anvil.app-server.run] Error report from client code:
InternalError: Internal server error: 155decd9a8ee
Traceback:
anvil-services/anvil/users/init.py:32

anvil-services/anvil/users/init.py:562

anvil-services/anvil/users/init.py:562

app/WrittenTestimoniesPrototype/Start/init.py:18

App is working fine otherwise.

Have set up verified identities for accounts@ and no-reply@ as well as the domain and in the IDE the test connection is fine and it works perfectly when using the custom domain. Error is only occurring in the app-server.

Any ideas? Product is due for handover this week and has to be in app-server as it needs the additional security for the held data in the DB.

Hi @james.patrick,

It looks like you’ve cut off the crucial first few lines of that traceback, which means it’s difficult to see what actually went wrong here! Can you give us a bit more of that log output here, please - ideally the full output, but at least from the start of that exception trace?

Also, can you tell us a bit more about your app? Best, of course, would be a minimal example + App Server config file/command-line to execute it (redacting your particular credentials, of course).

Otherwise, we can do our best with limited information, but I’d be asking questions like:

  • Does your app itself have Custom SMTP enabled in the Email service?
  • How are you providing SMTP settings to the App Server? Config file, or command line arguments? Can you provide snippets of the config file or command line (with credentials redacted) to show us what you’re doing?
  • What precise operations do you need to perform to reproduce this error (“testing email functions such as password reset in the login form” is very vague, and doesn’t clue anyone else in to how to reproduce the error!)

As I say, the very best of all would be a specific example (via Clone link or GitHub repo or whatever) with step-by-step instructions for reproducing the exact problem.

Hey Meredydd,

So…can’t share too much here due to use case.

The app handles data gathering and risk assurance across a couple of permissions groups / user views.

Works fine with Custom SMTP set up on SES (out of sandbox) in the IDE environment. Custom SMTP is enabled in the anvil.yaml.

Taken over into app-server have set up a config file with:

smtp-server-port: xx
smtp-host: “xx”
smtp-port: xx
smtp-encryption: “ssl”
smtp-username: “xx”
smtp-password: “xx”
other things: xx

Spin up with: anvil-app-server --config-file xxx.conf --app [app name]

Uplink works, encryptions keys all working, tables imported via download from IDE to CSV and upload via uplink and all working.

However, in the app server deployment no emails from accounts@ or no-reply@ work and the internal error gets thrown.

The error shown in the traceback is an example which points at the anvil.users.login with form line in the start module init, caused in that instance when you try and click forgot password in the login form. The same error occurs wherever an email is supposed to happen.

I am sure I’ve done something silly, but have tried with speech marks, without, and settled on the above configuration. I’ve read back through the old gits about fake-smtp server and aligned with that but can’t get my noodle around it.

Have tried to add the CLI commands for SMTP too, but that just hangs at the JAR line.

James

Hi James,

Thanks for the update - that narrowed down how the problem is caused. Could you please paste in the traceback information requested here, so we can see what exception was thrown in bowels of the App Server?

Sure, sorry was just off cutting and pasting:

2022-05-23 12:20:12,508 [ERROR anvil.dispatcher.native-rpc-handlers.util] Internal server error: 28be8be5eb1e
java.lang.UnsupportedOperationException
at anvil.app_server.secrets$get_global_app_secret_value.invokeStatic(secrets.clj:64)
at anvil.app_server.secrets$get_global_app_secret_value.invoke(secrets.clj:64)
at anvil.dispatcher.native_rpc_handlers.email$send_BANG_$fn__19228.invoke(email.clj:171)
at anvil.dispatcher.native_rpc_handlers.email$send_BANG_.invokeStatic(email.clj:171)
at anvil.dispatcher.native_rpc_handlers.email$send_BANG_.invoke(email.clj:80)
at anvil.dispatcher.native_rpc_handlers.users.core$send_email_BANG_.invokeStatic(core.clj:406)
at anvil.dispatcher.native_rpc_handlers.users.core$send_email_BANG_.invoke(core.clj:371)
at anvil.dispatcher.native_rpc_handlers.users.core$send_password_reset_email.invokeStatic(core.clj:496)
at anvil.dispatcher.native_rpc_handlers.users.core$send_password_reset_email.invoke(core.clj:481)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invokeStatic(core.clj:659)
at clojure.core$apply.invoke(core.clj:652)
at clojure.core$apply.invokeStatic(core.clj:659)
at clojure.core$apply.invoke(core.clj:652)
at anvil.dispatcher.native_rpc_handlers.util$wrap_native_fn$fn__537$fn__540$fn__549.invoke(util.clj:83)
at anvil.dispatcher.native_rpc_handlers.util$wrap_native_fn$fn__537$fn__540.invoke(util.clj:82)
at clojure.lang.AFn.run(AFn.java:22)
at anvil.core.worker_pool$run_one_task_BANG_.invokeStatic(worker_pool.clj:48)
at anvil.core.worker_pool$run_one_task_BANG_.invoke(worker_pool.clj:32)
at anvil.core.worker_pool$launch_thread_BANG_$fn__5565.invoke(worker_pool.clj:86)
at clojure.lang.AFn.run(AFn.java:22)
at java.lang.Thread.run(Thread.java:748)
2022-05-23 12:20:12,571 [ERROR anvil.app-server.run] Error report from client code:
InternalError: Internal server error: 28be8be5eb1e
Traceback:
anvil-services/anvil/users/init.py:32

anvil-services/anvil/users/init.py:562

anvil-services/anvil/users/init.py:562

app/WrittenTestimoniesPrototype/Start/init.py:18

Was just wondering if any joy on this after I posted the full traceback. Convinced it’s my error but brain won’t disentangle it.

Hi @james.patrick,

Thank you for the traceback! This should now be fixed, in App Server v1.7.0 :slight_smile:

1 Like

You are all awesome, thank you!

1 Like