Report this

What is the reason for this report?

Log forwarding from functions to logtail/Better Stack throws 401

Posted on April 26, 2025

I set up a function with the following project.yml file

packages:
  - name: sample
    actions:
      - name: hello
        runtime: 'python:default'
environment:
  LOG_DESTINATIONS: '[{"logtail":{"token":"MY_SOURCE_TOKEN"}}]'

When executing the function I get the following error

2025-04-26T11:43:54.97811523Z  stderr: Failed to flush logs: failed to ingest log line, code: 401

A curl using the token works tho

curl -X POST "https://s1287463.eu-nbg-2.betterstackdata.com" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer MY_SOURCE_TOKEN" \
-d '{"message":"Test from curl"}'

Does anybody have an idea how I could investigate the issue?



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.
0

Accepted Answer

The support was super helpful and we solved it. Choose “Digital Ocean” as Platform on logtail/Better Stack instead of “HTTP”. Documentation still says “HTTP”. So that’s what confused me.

Hi there,

I could suggest double-checking the MY_SOURCE_TOKEN value to make sure that it is correct and that it does not have any whitespaces for example.

If everything looks right and it’s still failing, it’s worth reaching out to the DigitalOcean Support to double-check if there’s an issue on their side.

- Bobby

The developer cloud

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

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.