We have a private add-on running as a Simple Function. The documented limits,
15 seconds and 128 MB, are now the binding constraint: the add-on renders test
certificates as a PDF, and a job with 72 completed forms takes 10.9 seconds to
draw and 13.9 seconds end to end. A job with 98 forms uses 12.8 of the 15. The
same work on a Lambda we host ourselves at 1769 MB takes 1.5 seconds.
So we tried to move it, and hit three things we could not resolve from the
documentation.
- The Callback URL field will not take a Lambda ARN.
Setting Addon Type to “Self-Hosted Web Service Function” and pasting an ARN for
a function in our own AWS account gives “Not Ready (Invalid Callback URL)”. We
had expected this to work, because that same field holds an ARN when the add-on
is a Simple Function: it shows one pointing at ExternalSDK-SimpleFunction- in a ServiceM8 owned AWS account, with an alias per deployment.
Is there a supported way to configure an “AWS Lambda Function Add-on” as
described under Add-on Types, for a private add-on? The Addon Type dropdown
offers only External Integration, Self-Hosted Web Service Function, and Simple
Function (NodeJS). If it is supported, which AWS principal does ServiceM8 invoke
from, so we can write the resource-based policy?
- A Lambda Function URL works, but only on a newly created add-on.
Giving the same Lambda a Function URL and putting that HTTPS URL in the Callback
URL box works correctly on an add-on we created fresh for testing. ServiceM8
POSTs the JWT, we verify the HS256 signature with the App Secret, return
{“eventResponse”: “…”} and the modal renders it. 72 certificates came
back in 2.4 seconds.
Putting the identical configuration on our existing add-on, the one that has been
a Simple Function since 14 September, does not work. Status reports Ready, the
buttons appear, and every press returns:
“ServiceM8 is not authorized to invoke your addon Lambda function. Please
review Addon SDK Documentation regarding granting ServiceM8 access to invoke
your function and try again.”
Our CloudWatch logs show no request arriving at all, so ServiceM8 is not calling
the URL. It appears still to be attempting a Lambda invoke. We verified the three
fields directly in the form: addon_type is web-service-integration,
addon_callback_url is the https://.lambda-url..on.aws/ address, and
activation_url is set. Toggling it to an invalid value and back did not change
the behaviour.
Is there residual state on an add-on converted from a Simple Function that has to
be cleared, or is creating a new add-on the only path?
- Two smaller things that cost us time, in case they are worth a doc note.
Deploying a bundle to an add-on that is configured as a web service silently
resets Addon Type to Simple Function and overwrites the Callback URL with
ServiceM8’s own ARN. The Activation URL survives, so the settings page afterwards
looks partly changed rather than reset.
The Web Service Hosted Add-ons page says the output “will be rendered into the
ServiceM8 UI inside an iframe”, which reads as though it wants HTML. Returning
HTML gives “Invalid JSON Response Received”. It wants the same envelope a Lambda
returns, {“eventResponse”: “…”}. Worth saying explicitly on that page.
Related support request: #340637.