Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component does not handle empty attachments correctly #34

Open
jhorbulyk opened this issue May 11, 2020 · 0 comments · Fixed by #35
Open

Component does not handle empty attachments correctly #34

jhorbulyk opened this issue May 11, 2020 · 0 comments · Fixed by #35

Comments

@jhorbulyk
Copy link
Contributor

jhorbulyk commented May 11, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant