GithubHelp home page GithubHelp logo

elasticio / edifact-parser-component Goto Github PK

View Code? Open in Web Editor NEW
0.0 9.0 3.0 647 KB

Integration component for elastic.io that parses edifact files

License: Other

JavaScript 100.00%
eio-component edi edifact

edifact-parser-component's Introduction

CircleCI

edifact-parser-component

Table of Contents

General information

Description

EDIFACT Parser component for the elastic.io platform. It reads incoming attachments and parses them using EDI parser.

Credentials

This component requires no authentication.

Actions

Parse

EDIFACT Parse action expects an incoming message(es) with EDI attachment(s) in it.

Sample EDI file you can find here, and here you will see resulting JSON message body after parsing.

Triggers

No triggers yet

License

Apache-2.0 © elastic.io GmbH

edifact-parser-component's People

Contributors

denyshld avatar if0s avatar stas-fomenko avatar zubairov avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

edifact-parser-component's Issues

Improve Parse action error handling

Description:

Implement error handling, throw some meanungfull error when:

  1. no file comes from previous step UPD: FIXED
  2. not an .EDI file comes from previous step
AR: no error thrown
LOGS: 
[2021-03-09 18:10:18.303]: [INFO  tini (1)] Spawned child process '/run.sh' with pid '6'
[2021-03-09 18:10:18.304]: Starting application in apprunner...
[2021-03-09 18:10:18.322]: node: /usr/lib/libstdc++.so.6: no version information available (required by node)
[2021-03-09 18:10:18.322]: node: /usr/lib/libstdc++.so.6: no version information available (required by node)
[2021-03-09 18:10:18.322]: node: /usr/lib/libstdc++.so.6: no version information available (required by node)
[2021-03-09 18:10:18.322]: node: /usr/lib/libstdc++.so.6: no version information available (required by node)
[2021-03-09 18:10:18.322]: node: /usr/lib/libstdc++.so.6: no version information available (required by node)
[2021-03-09 18:10:18.322]: node: /usr/lib/libstdc++.so.6: no version information available (required by node)
[2021-03-09 18:10:18.322]: Will try to start app at /home/apprunner
[2021-03-09 18:10:18.322]: node: /usr/lib/libstdc++.so.6: no version information available (required by node)
[2021-03-09 18:10:18.322]: node: /usr/lib/libstdc++.so.6: no version information available (required by node)
[2021-03-09 18:10:19.348]: Received step data
[2021-03-09 18:10:19.349]: Component path is: /home/apprunner
[2021-03-09 18:10:19.349]: Root files: [".circleci",".editorconfig",".eslintrc.js",".gitattributes",".gitignore",".heroku",".npmrc",".profile.d",".release","CHANGELOG.md","LICENSE","README.md","component.json","lib","logo.png","node_modules","package-lock.json","package.json","sail.sh","samples","serve.sh","spec"]
[2021-03-09 18:10:19.350]: Triggers: []
[2021-03-09 18:10:19.350]: Actions: ["parse"]
[2021-03-09 18:10:19.350]: Successfully loaded /home/apprunner/component.json
[2021-03-09 18:10:19.351]: About to initialize component for execution
[2021-03-09 18:10:19.352]: Trying to find module at: /home/apprunner/lib/actions/parse.js
[2021-03-09 18:10:19.380]: Start listening for messages on 5a82f375a847400007c8d569:60479da183125a00118f684e/ordinary:step_7:messages
[2021-03-09 18:10:19.380]: invokeModuleFunction – init is not found
[2021-03-09 18:10:19.380]: Component execution initialized successfully
[2021-03-09 18:10:22.802]: Message received
[2021-03-09 18:10:22.815]: No object id header so not lightweight.
[2021-03-09 18:10:22.815]: Trigger or action: parse
[2021-03-09 18:10:22.815]: No object id header so not lightweight.
[2021-03-09 18:10:22.815]: No object id header so not lightweight.
[2021-03-09 18:10:22.815]: processMessage received
[2021-03-09 18:10:22.815]: Going to check if passthrough for step is lightweight. { stepId: 'step_1' }
[2021-03-09 18:10:22.815]: Going to check if passthrough for step is lightweight. { stepId: 'step_6' }
[2021-03-09 18:10:22.815]: Trying to find module at: /home/apprunner/lib/actions/parse.js
[2021-03-09 18:10:22.815]: Going to check if incoming message body is lightweight.
[2021-03-09 18:10:22.815]: Checking if incoming messages is lightweight...
[2021-03-09 18:10:22.815]: Checking if incoming messages is lightweight...
[2021-03-09 18:10:22.815]: Checking if incoming messages is lightweight...
[2021-03-09 18:10:22.832]: Starting parse action...
[2021-03-09 18:10:22.832]: Attachment found
[2021-03-09 18:10:22.832]: Sending GET request to provided url
[2021-03-09 18:10:22.837]: Message #1 ack
[2021-03-09 18:10:22.848]: processMessage emit end
[2021-03-09 18:10:22.867]: Have got response status=200
[2021-03-09 18:10:22.867]: Parsing EDIFACT...
[2021-03-09 18:10:22.868]: at Request.emit (events.js:327:22)
[2021-03-09 18:10:22.868]: at Object.onceWrapper (events.js:421:28)
[2021-03-09 18:10:22.868]: at processTicksAndRejections (internal/process/task_queues.js:80:21)
[2021-03-09 18:10:22.868]: at Parser.write (/home/apprunner/node_modules/edifact/parser.js:151:29)
[2021-03-09 18:10:22.868]: at Object.invalidControlAfterSegment (/home/apprunner/node_modules/edifact/parser.js:237:12)
[2021-03-09 18:10:22.868]: at IncomingMessage.emit (events.js:327:22)
[2021-03-09 18:10:22.868]: at endReadableNT (internal/streams/readable.js:1327:12)
[2021-03-09 18:10:22.868]: (node:6) UnhandledPromiseRejectionWarning: Error: Invalid character � after reading segment name
[2021-03-09 18:10:22.868]: at IncomingMessage.<anonymous> (/home/apprunner/node_modules/request/request.js:1076:12)
[2021-03-09 18:10:22.868]: at Request.<anonymous> (/home/apprunner/lib/actions/parse.js:83:14)
[2021-03-09 18:10:22.868]: (Use `node --trace-warnings ...` to show where the warning was created)
[2021-03-09 18:10:22.868]: (node:6) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
[2021-03-09 18:10:22.868]: (node:6) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[2021-03-09 18:10:54.573]: Received SIGTERM
[2021-03-09 18:10:54.573]: Disconnecting, 0 messages in processing
[2021-03-09 18:10:54.573]: scheduleShutdown – about to shutdown immediately
[2021-03-09 18:10:54.573]: Disconnecting...
[2021-03-09 18:10:54.573]: Close AMQP connections
[2021-03-09 18:10:54.589]: Successfully disconnected
[2021-03-09 18:10:54.589]: [INFO  tini (1)] Main child exited normally (with status '0')
[2021-03-09 18:10:54.589]: Successfully closed AMQP connections
[2021-03-09 18:11:28.236]: node: /usr/lib/libstdc++.so.6: no version information available (required by node)
[2021-03-09 18:11:28.236]: [INFO  tini (1)] Spawned child process '/run.sh' with pid '6'
[2021-03-09 18:11:28.236]: Starting application in apprunner...
[2021-03-09 18:11:28.236]: node: /usr/lib/libstdc++.so.6: no version information available (required by node)
[2021-03-09 18:11:28.236]: Will try to start app at /home/apprunner
[2021-03-09 18:11:28.236]: node: /usr/lib/libstdc++.so.6: no version information available (required by node)
[2021-03-09 18:11:28.236]: node: /usr/lib/libstdc++.so.6: no version information available (required by node)
[2021-03-09 18:11:28.236]: node: /usr/lib/libstdc++.so.6: no version information available (required by node)
[2021-03-09 18:11:28.236]: node: /usr/lib/libstdc++.so.6: no version information available (required by node)
[2021-03-09 18:11:28.236]: node: /usr/lib/libstdc++.so.6: no version information available (required by node)
[2021-03-09 18:11:28.236]: node: /usr/lib/libstdc++.so.6: no version information available (required by node)
[2021-03-09 18:11:29.097]: Root files: [".circleci",".editorconfig",".eslintrc.js",".gitattributes",".gitignore",".heroku",".npmrc",".profile.d",".release","CHANGELOG.md","LICENSE","README.md","component.json","lib","logo.png","node_modules","package-lock.json","package.json","sail.sh","samples","serve.sh","spec"]
[2021-03-09 18:11:29.097]: Received step data
[2021-03-09 18:11:29.097]: Component path is: /home/apprunner
[2021-03-09 18:11:29.098]: Successfully loaded /home/apprunner/component.json
[2021-03-09 18:11:29.098]: Triggers: []
[2021-03-09 18:11:29.098]: Actions: ["parse"]
[2021-03-09 18:11:29.102]: About to initialize component for execution
[2021-03-09 18:11:29.102]: Trying to find module at: /home/apprunner/lib/actions/parse.js
[2021-03-09 18:11:29.133]: Start listening for messages on 5a82f375a847400007c8d569:60479da183125a00118f684e/ordinary:step_7:messages
[2021-03-09 18:11:29.133]: Component execution initialized successfully
[2021-03-09 18:11:29.133]: invokeModuleFunction – init is not found
[2021-03-09 18:12:10.001]: Disconnecting...
[2021-03-09 18:12:10.001]: Disconnecting, 0 messages in processing
[2021-03-09 18:12:10.001]: Close AMQP connections
[2021-03-09 18:12:10.001]: Received SIGTERM
[2021-03-09 18:12:10.001]: scheduleShutdown – about to shutdown immediately
[2021-03-09 18:12:10.012]: Successfully disconnected
[2021-03-09 18:12:10.012]: Successfully closed AMQP connections
[2021-03-09 18:12:10.026]: [INFO  tini (1)] Main child exited normally (with status '0')
  1. more then 1 EDI file comes from previous step

so, improve error handling in order to allow the action to work only with 1 file/execution (sample retrieve) and it must be .EDI file

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.