Skip to content

Component does not handle empty attachments correctly #34

@jhorbulyk

Description

@jhorbulyk

Steps to reproduce

  1. Create a 3 step flow of the following form:
  • Code component with

    this input code
    async function run(msg, cfg, snapshot) {
    const urlRequest = await request({
    url: 'https://api.elastic.io/v2/resources/storage/signed-url',
    method: 'POST',
    auth: {
    username: process.env.ELASTICIO_API_USERNAME,
    password: process.env.ELASTICIO_API_KEY
    }
    });
    const url = JSON.parse(urlRequest.body).get_url;

    const putRequest = await request({
    url,
    method: 'PUT'
    });

    this.emit('data', {body: {
    url
    },
    attachments: {
    'file.xml': {
    url
    }
    }
    });
    }

  • XML component: XML Attachment to JSON
    • Pattern to match files: .
  • Email component: send email
    • To:
    • Subject: Test
    • Body: Test
  1. Publish the flow and run it once.

Expected Result

XML component throws an error since the attachment contains the empty string which is not valid XML.

Actual result

An error badge appears around the email component: Cannot use 'in' operator to search for 'elasticio' in null

This Sailor bug is partially to blame for the above behavior: elasticio/sailor-nodejs#64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions