Runtime logs for Serverless Functions in App Platform
Joe Skeen
Currently if you are using serverless functions within App Platform, the only way to get any logs from them is to export logs to a third-party service. Seriously,
console.log('Hello World')
won't show up unless you sign up for either Logtail or Datadog. This is really not good for people getting started with Serverless Functions on DigitalOcean and is a major deterrent for using this platform as opposed to literally any other cloud platform with functions.P
Preston Hollis
To add more detail, the only time logs are generated is when we create an access key for the namespace and use the following command in terminal:
curl -X POST "https://faas-nyc1-2ef2e6cc.doserverless.co/api/v1/namespaces/<namespace-id>/actions/<package>/<function>?blocking=false" \
-H "Content-Type: application/json" \
-u "<access-key-id>:<secret>"
While somewhat useful for developers making their own invocations, that only gives logs for async invocations we trigger ourselves, not for normal web traffic (GET, PUT, DELETE, etc.) from users. Developers want to be able to see every web invocation made so if something unexpected fails, it can be tracked and fixed. Without this it is very difficult to debug.
As Joe Skeen stated, there are third-party solutions, however it's an inconvenience to have to set up an additional service. More importantly, it's a security risk when functions run in one place and logs are sent elsewhere.