Use s3-streamlogger with DigitalOcean Spaces

September 24, 2018 707 views
Node.js Logging

I am using s3-streamlogger along with DigitalOcean Spaces, and in order to create logs into my bucket I use the following code:

import { S3StreamLogger } from 's3-streamlogger';

const s3Stream = new S3StreamLogger({
  bucket: "mybucket",
  config: {
    endpoint: 'nyc3.digitaloceanspaces.com'
  },
  access_key_id: "MY_ACCESS_KEY",
  secret_access_key: "MY_SECRET_KEY",
  tags: {type: "error", project: "myproject"}
});

s3Stream.write("hello S3");

In the configuguration, if I omit the tags: {type: "error", project: "myproject"} an InvalidArgument: Null exception is raised.

Is this a normal behavior or an incompatibility with S3?

1 Answer

Hey friend!

To me that sounds like the application is kicking back the configuration, but if you’re seeing more that indicates our servers returned that message, please correct me as I may be wrong. I’m taking a shot in the dark here because I’m just not big into using object storage in it’s intended ways myself, but is there a chance that when you remove that line the configuration is kicking back because of the trailing comma at the end of the secretaccesskey line?

I realize it could be a very stupid question and no help at all, but I figured it was worth a try as no one else was weighing in on it.

Jarland

Have another answer? Share your knowledge.