We have updated our Terms of Service, Code of Conduct, and Addendum.

Custom function error log location

dmtrs
dmtrs Posts: 5

I’m writing a custom function and I’m able to add it to a pipeline. However, when I try to process an event, I get an error.

Here’s the content of my index.js:

exports.name = ‘MyCustomFunction’;
exports.group = ‘Custom Functions’;
exports.version = 0.1;

exports.init = (opts) => {
const conf = opts.conf || {};
};

exports.process = (event) => {
return event; // noop
};

I’m unable to find where, if any, error messages are written to the logs. I looked at the logs under Monitoring (Logs tab) and docker logs with no success.

Are errors of this type written anywhere?

Best Answer

  • Brandon McCombs
    Brandon McCombs Posts: 150 mod
    edited July 2023 Answer ✓

    You are trying to reference events before it has been defined.

    Im not an expert on JS so this may not be the most optimal but it does work:

    let name = 'MyCustomFunction';let group = 'Custom Functions';let version = 0.1;const exports = { name: name, group: group, version: version };exports.init = (opts) => {const conf = opts.conf || {};};exports.process = (event) => {return event; // noop};
    

    As far as where to find the errors, when previewing your data click the Gear button below the Run button, as shown in the image, then choose Preview Log.

Answers

  • dmtrs
    dmtrs Posts: 5

    I think we are saying the same thing, in code.

    I discovered my issue. While developing the function. Something was in an "invalid state". I was able to correct the issue by deleting/removing values in my function and redefining.

    Thanks for the pointer to the "Preview Log".

  • Brandon McCombs
    Brandon McCombs Posts: 150 mod
    edited July 2023 Answer ✓

    You are trying to reference events before it has been defined.

    Im not an expert on JS so this may not be the most optimal but it does work:

    let name = 'MyCustomFunction';let group = 'Custom Functions';let version = 0.1;const exports = { name: name, group: group, version: version };exports.init = (opts) => {const conf = opts.conf || {};};exports.process = (event) => {return event; // noop};
    

    As far as where to find the errors, when previewing your data click the Gear button below the Run button, as shown in the image, then choose Preview Log.