elasticio / sftp-component

SFTP component for the elastic.io platform
Apache License 2.0
2 stars 3 forks source link

Error `File's metadata is not found` when trying to read attachments after execution trigger `Read files` #16

Closed shulkaolka closed 5 years ago

shulkaolka commented 5 years ago

The problem was found during xml-component testing. image

STR:

  1. Create flow SFTP -> xml-component (Action: XML Attachment to JSON) Start flow. AR: Error is shown in flow with Action: XML Attachment to JSON Error in making request to http://steward-service.platform.svc.cluster.local:8200/files/773544b5-900a-45d7-8e55-0336830373e1 Status code: 404, Body: "File's metadata is not found"

ER: Attachment with XML is readed correct.

NOTE:

I tried to send XML file via SFTP: <climate> [20/1857] <weather> <city>Hjyjioio</city> <temp_lo>8</temp_lo> <temp_hi>38</temp_hi> <prcp>56.0</prcp> <date>2010-02-01</date> </weather> <weather> <city>Ijrjrtjgdc</city> <temp_lo>9</temp_lo> <temp_hi>26</temp_hi> <prcp>-45.45</prcp> <date>2016-03-11</date> </weather> <weather> <city>Ohttvnev</city> <temp_lo>1</temp_lo> <temp_hi>25</temp_hi> <prcp>-4</prcp> <date>2013-07-01</date> </weather> </climate>

After Error was shown I followed a link, and looked into attachment and this is what was in it: ` [20/1857]

Hjyjioio

8 38

56.0 2010-02-01

Ijrjrtjgdc

9 26

-45.45 2016-03-11

Ohttvnev

1 25

-4 2013-07-01

{ "climate": { "weather": [ { "city": "Hjyjioio", "temp_lo": "8", "temp_hi": "38", "prcp": "56.0", "date": "2010-02-01" }, { "city": "Ijrjrtjgdc", "temp_lo": "9", "temp_hi": "26", "prcp": "-45.45", "date": "2016-03-11" }, { "city": "Ohttvnev", "temp_lo": "1", "temp_hi": "25", "prcp": "-4", "date": "2013-07-01" } ] } }

{ "metadata": {}, "headers": {}, "body": { "climate": { "weather": [ { "date": "2010-02-01", "prcp": "56.0", "temp_hi": "38", "temp_lo": "8", "city": "Hjyjioio" }, { "date": "2016-03-11", "prcp": "-45.45", "temp_hi": "26", "temp_lo": "9", "city": "Ijrjrtjgdc" }, { "date": "2013-07-01", "prcp": "-4", "temp_hi": "25", "temp_lo": "1", "city": "Ohttvnev" } ] } }, "attachments": {}, "id": "e486ee4b-0123-460b-8aab-b1aecf14beb8" } `

kirill-levitskiy commented 5 years ago

The issue can be solved from the consumer's side with additional feature retry-request. It should make a retry of requesting attachment, if previous request returns:

The same feature has been implemented in AWS S3 component already https://github.com/elasticio/aws-s3-component/commit/e1644c78c3bbde3f5c9b60ba9856b1ba47add0b3#diff-90c4b4ffe1cffbb5d2dcd445d0df5df7R50.

zubairov commented 5 years ago

The retry feature is generally usefull (due to various reasons) but that particular issue above was fixed in PR https://github.com/elasticio/sftp-component/pull/17 and was caused by the error in the implementation of SFTP component.

@juhrmacher could you please consider work to merge the PR above to the next sprint?