Lambda-promtail collecting cloudfront logs from s3


I am in the middle of setting up lambda-promtail to collect cloudfront logs from an s3 bucket. I am stuck with an error I can’t narrow down anymore.
This is the error from the lambda logs: calling the handler function resulted in a panic, the process should exit.

I have built the image and uploaded it to my ECR, then I updated the provided terraform module to match into my environment. Everything is deployed successfully but ends with the mentioned error.

It looks like the promtail is not even connecting to the promtail with loki-push-api configured.

The logs in in the bucket have the file name format S0ME1D.2022-05-07-02.some-id.gz.

Is there any best practices or other examples on how to do this?