Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

By kprichard
I get no activation records or log messages when I run serverless functions via doctl. I have a working python 3.11 serverless function that does what I expect, except that logging doesn’t appear anywhere, and there are no activation records-
$ doctl serverless activations list hello-world/mainy
Datetime Status Kind Version Activation ID Start Wait Duration Function
(no records, just headers)
$ doctl serverless activations list
Datetime Status Kind Version Activation ID Start Wait Duration Function
(no records, just headers)
$ doctl serverless activations logs -f hello-world/mainy
(no output)
$ doctl serverless activations logs
(no output)
I’ve run the function successfully a handful of times, and still nothing. Is there a latency period for logs to appear? I started yesterday, still seeing nothing today.
Here is the function def-
import json
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
def main(args):
try:
logger.warning("Starting hello-world function")
logger.warning(str(args))
logger.info("This is an info log")
logger.debug("This is a debug log")
name = args.get("name", "")
if not name:
name = "world"
retval = {
"statusCode": 200,
"headers": {
'Content-Type': 'text/html',
},
"body": f"""<html><body>Hello, {name}<br><br><pre>
Type: "{type(args)}"
Class: "{args.__class__.__name__}"
{json.dumps(args, indent=4, sort_keys=True)}</pre></body></html>""",
}
logger.warning(f"Returning: {retval}")
logger.error(f"Returning: {json.dumps(retval)}")
return retval
except Exception as e:
logger.exception(e)
return {"error": str(e)}
project.yml:
packages:
- name: hello-world
functions:
- name: mainy
parameters:
runtime: "python:3.11"
web: true
limits:
timeout: 10000 # 10 seconds
memory: 512
DM me for URL / function UUID.
Regarding third-party logging / log forwarding, I’d rather not use or pay for external logging while I’m just trying out Functions, you know what I mean? I’m want to get something working, to learn whether DO Functions meets my needs. If it looks production-worthy and I continue development, then I’ll sign up for external logging.
At this point, I’m having to embed log type info into my response object, which isn’t ideal but it’s getting me by for now.
Also fyi-
Scott H
shadowsyntax
Seymen Pek
Sergiu Groza
0298427ee98b4b8db926b556dbe006
ef4b1618a83246338d8eff880389a8
DriftingDarkCyanJellyfish
Sebastian Chlopecki
a5703f8b90bc4343b563db6eaa6558
sranvir
accounts9dff3738ad014accdd