I’m using DigitalOcean App Platform Functions to run a Python script. The function runs correctly, it updates the database and behaves as expected, but I’m not seeing any of my logs in the Runtime Logs tab or via the CLI.
I’ve tried both print() and Python’s logger.info() (with a StreamHandler(sys.stdout)), and placed them at the top of my main() function. Still, none of the expected logs appear.
When I run this command to check logs from the terminal:
doctl apps logs <APP_ID>
I get the following error:
Error: error creating websocket connection: websocket: bad handshake
The only logs I see in the Runtime Logs tab are the following, which are not helpful:
[2025-05-01 07:55:13] Begin getUploadUrl activation 12a45de9c8a046f5a45de9c8a006f5fb
[2025-05-01 07:55:14] Finished getUploadUrl activation 12a45de9c8a046f5a45de9c8a006f5fb in 23ms. Status: success
[2025-05-01 07:55:17] Begin getUploadUrl activation 6839a0e4e7f14c1cb9a0e4e7f16c1c9c
[2025-05-01 07:55:17] Finished getUploadUrl activation 6839a0e4e7f14c1cb9a0e4e7f16c1c9c in 7ms. Status: success
[2025-05-01 07:55:18] Begin build_python_3.11 activation 3235cff8c58a4acab5cff8c58a6acabc
[2025-05-01 07:55:30] stdout: calling build
[2025-05-01 07:55:30] stdout: {'toBuild': 'builds/ap-323d3650-4d4e-47ae-8b93-eb2566e89fb2/ebs-hubspotintegration_fetch-and-store/2025-05-01T07-55-13.983Z'}
[2025-05-01 07:55:30] stdout: ['dosls', 'deploy', 'slice:builds/ap-323d3650-4d4e-47ae-8b93-eb2566e89fb2/ebs-hubspotintegration_fetch-and-store/2025-05-01T07-55-13.983Z']
[2025-05-01 07:55:30] stdout: subprocess created
[2025-05-01 07:55:30] stdout: subprocess finished, rc=0
[2025-05-01 07:55:30] stdout: decoding stdout
[2025-05-01 07:55:30] stdout: build returned
[2025-05-01 07:55:30] Finished build_python_3.11 activation 3235cff8c58a4acab5cff8c58a6acabc in 11.83s. Status: success
[2025-05-01 07:55:20] Begin build_python_3.11 activation bf34acbf473d4986b4acbf473dd98606
[2025-05-01 07:55:30] stdout: calling build
[2025-05-01 07:55:30] stdout: {'toBuild': 'builds/ap-323d3650-4d4e-47ae-8b93-eb2566e89fb2/ebs-hubspotintegration_process-sync/2025-05-01T07-55-17.279Z'}
[2025-05-01 07:55:30] stdout: ['dosls', 'deploy', 'slice:builds/ap-323d3650-4d4e-47ae-8b93-eb2566e89fb2/ebs-hubspotintegration_process-sync/2025-05-01T07-55-17.279Z']
[2025-05-01 07:55:30] stdout: subprocess created
[2025-05-01 07:55:30] stdout: subprocess finished, rc=0
[2025-05-01 07:55:30] stdout: decoding stdout
[2025-05-01 07:55:30] stdout: build returned
[2025-05-01 07:55:30] Finished build_python_3.11 activation bf34acbf473d4986b4acbf473dd98606 in 10.311s. Status: success
[2025-05-01 07:55:21] Begin getDownloadUrl activation 76022c468015433d822c468015233d32
[2025-05-01 07:55:21] Finished getDownloadUrl activation 76022c468015433d822c468015233d32 in 17ms. Status: success
[2025-05-01 07:55:21] Begin getDownloadUrl activation e39c55e59a2a44b59c55e59a2a84b566
[2025-05-01 07:55:21] Finished getDownloadUrl activation e39c55e59a2a44b59c55e59a2a84b566 in 6ms. Status: success
[2025-05-01 07:55:28] Begin deleteBuildAssets activation 6b84b105b03840fd84b105b03890fdac
[2025-05-01 07:55:28] Finished deleteBuildAssets activation 6b84b105b03840fd84b105b03890fdac in 139ms. Status: success
[2025-05-01 07:55:28] Begin deleteBuildAssets activation 0b7f6d6525b54a9ebf6d6525b52a9e3c
[2025-05-01 07:55:28] Finished deleteBuildAssets activation 0b7f6d6525b54a9ebf6d6525b52a9e3c in 129ms. Status: success
When using the DO API to retrieve the logs, I get the same logs as the ones above.
Is there something I’m missing about how logging works in App Platform Functions? Or is this a known issue with doctl?
Any help would be appreciated!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hey!
I’ve run into something similar with App Platform Functions and Python too. One thing that might help is sticking with plain
print()
for logging. I’ve had mixed results with custom loggers, especially if the logs don’t flush before the function exits.Also worth checking if your function is async or uses threading, in some cases, logs don’t always make it through before the function finishes.
That WebSocket error from
doctl
looks like a separate issue, retrying sometimes works, but if it keeps happening, it’s probably best to reach out to support so they can take a closer look: https://do.co/supportLet me know how it goes!
- Bobby