Report this

What is the reason for this report?

How to properly use LOG_DESTINATIONS env var for functions?

Posted on November 17, 2022

As soon I set the LOG_DESTINATIONS as per the doc here, my function stop working.

I’m getting the following error:

stderr: Command exited abruptly during initialization. stderr: The action did not initialize or run as expected. Log data might be missing.

I’m using Logtail with an HTTP source.

I’ve tried to set the LOG_DESTINATIONS environment variable through my project.yml and through the web interface. Same result.

And if I remove that environment variable, the function start to work again.

Any idea?



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.

I faced the same problem as you did. To resolve it, avoid using any ES6 module syntax.

First, check your package.json file. If it includes "type": "module", remove this line.

Next, review the commands in your main file (e.g., index.js). For example, if you want to import mysql, use const mysql = require("mysql2/promise"); instead of import mysql from "mysql2/promise";. Similarly, if you want to export a function, use exports.main = main instead.

I hope this guidance proves helpful. Best of luck!

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.