Skip to content

oci-serviceconnector-streaming-json-to-csv-python not working #50

Open
@MarcGueury

Description

@MarcGueury

The sample is not working.

https://github.com/oracle-samples/oracle-functions-samples)/[samples](https://github.com/oracle-samples/oracle-functions-samples/tree/master/samples)/oci-serviceconnector-streaming-json-to-csv-python/

The input of the service connector looks like this:

"01GBK286021BT0Q4RZJ002PCNH - root - INFO - {'stream': 'mg-input-sc', 'partition': '0', 'key': None, 'value': 'W3sic3RyZWFtIjogIm15bmV3c3RyZWFtIiwicGFydGl0aW9uIjogIjAiLCJ2YWx1ZSI6ICJleUp1WVcxbElqb2lhV2R2Y2lJc0lDSnNiMk5oZEdsdmJpSTZJQ0pFZFdKc2FXNGlmUT09Iiwib2Zmc2V0IjogMCwidGltZXN0YW1wIjogIjIwMTgtMDQtMjZUMDE6MDM6MDYuMDUxWiJ9LHsic3RyZWFtIjogIm15bmV3c3RyZWFtIiwicGFydGl0aW9uIjogIjAiLCJ2YWx1ZSI6ICJleUp1WVcxbElqb2lZbkpwWVc0aUxDSm1hV1ZzWkRFaU9pSjBaWE4wSW4wPSIsIm9mZnNldCI6IDAsInRpbWVzdGFtcCI6ICIyMDE4LTA0LTI2VDAxOjAzOjA2LjA1MVoifV0=', 'offset': 10, 'timestamp': 1661718357219}"

Notice that key is None.

I am not sure why it is written this part of the code but this is causing issue:

        if 'key' in item:
            item['key'] = base64_decode(item['key'])

The same problem happens also with the test.json file that is in the sample directory.
If you remove the lines, it works. I am not sure of the intention of these 2 lines.

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