Luidog / node-red-contrib-filemaker

A Node Red FileMaker module. This module uses the FileMaker Data API to connect with a FileMaker server.
33 stars 7 forks source link

Extract Containers Error #26

Closed mw777eds closed 5 years ago

mw777eds commented 5 years ago

Using your example for extract containers I get the following error: The 'url" argument must be of type string. Received type undefined. Screen Shot 2019-09-30 at 4 41 00 PM

[{"id":"4312884a.7c3d78","type":"dapi-list-records","z":"4c85bfc7.7cb05","name":"","client":"628e510d.39603","layout":"payload.layout","layoutType":"msg","limit":"payload.limit","limitType":"msg","offset":"","offsetType":"num","sort":"","sortType":"none","scripts":"","scriptsType":"none","portals":"","portalsType":"none","output":"payload.list","x":310,"y":60,"wires":[["ea86bda9.1fc53"]]},{"id":"25e6b154.ac63fe","type":"inject","z":"4c85bfc7.7cb05","name":"Inject","topic":"","payload":"{\"layout\":\"STD__Students\",\"limit\":\"1\",\"container\":\"fieldData.container\",\"filename\":\"fieldData.filename\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":60,"wires":[["4312884a.7c3d78"]]},{"id":"cab00b58.bd5258","type":"debug","z":"4c85bfc7.7cb05","name":"debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":730,"y":60,"wires":[]},{"id":"f4b38c37.d5cfb","type":"catch","z":"4c85bfc7.7cb05","name":"errors","scope":null,"x":570,"y":120,"wires":[["cab00b58.bd5258"]]},{"id":"ea86bda9.1fc53","type":"dapi-container-data","z":"4c85bfc7.7cb05","name":"","parameters":"","parameterType":"none","data":"payload.list.data","dataType":"msg","field":"payload.container","fieldType":"msg","filename":"payload.filename","filenameType":"msg","destination":"","destinationType":"buffer","output":"payload.containerData.data","x":530,"y":60,"wires":[["cab00b58.bd5258"]]},{"id":"628e510d.39603","type":"dapi-client","z":"","name":"School","timeout":"","concurrency":"1"}]

Luidog commented 5 years ago

@mw777eds,

Thank you for raising this issue. The extract container node is one of the more complex nodes in the project.

I appreciate you providing an image and example flow. This helps me significantly. I reviewed the tests for the container node and imported the example flow into my a test environment.

As it turns out, the error you are seeing is most likely from a misconfiguration and not an issue with the node itself. This project is perpetualy a work in progress. The issue you raised and the poor error message highlights the need for additional documentation for some of the more complex nodes.

The error shown in the image is thrown when the node can not find the Data API URL for the file it is supposed to extract. The most common cause for this is a misconfiguration of the node's container property. In the example, this property is configured in the inject node as fieldData.container.

@mw777eds Can you confirm that you have a URL in the payload.list.data array in the fieldData.container property? Here is a more concrete example:

Given the following input:

{
    "data": [
        {
            "fieldData": {
                "name": "Luke Skywalker",
                "filename": "Luke-Skywalker.png",
                "id": "38A5D5A7-473F-9F40-AF3B-6894B6D684C3",
                "bio": "Discovered as a slave on Tatooine by Qui-Gon Jinn and Obi-Wan Kenobi, Anakin Skywalker had the potential to become one of the most powerful Jedi ever, and was believed by some to be the prophesied Chosen One who would bring balance to the Force. A hero of the Clone Wars, Anakin was caring and compassionate, but also had a fear of loss that would prove to be his downfall.",
                "photo": "https://some-server.com/Streaming_SSL/MainDB/F483F8751E6891672E410D2A19850D980AC61DCDC4269ADDA38694496DE5292E.png?RCType=EmbeddedRCFileProcessor",
            },
            "recordId": "69622",
            "modId": "2"
        }
    ]
}

I would configure the extract container node like this:

[
    {
        "id": "f3ef4b70.47d88",
        "type": "dapi-container-data",
        "z": "bf0e276f.55d598",
        "name": "",
        "parameters": "",
        "parameterType": "none",
        "data": "payload.data",
        "dataType": "msg",
        "field": "fieldData.photo",
        "fieldType": "msg",
        "filename": "fieldData.filename",
        "filenameType": "msg",
        "destination": "",
        "destinationType": "buffer",
        "output": "payload.files",
        "x": 530,
        "y": 60,
        "wires": [
            [
                "33b3f243.e04af6"
            ]
        ]
    }
]

Please notice the values in the filename and field properties of the configuration object

I hope this helps you. Feel free to reopen this issue should continue to see an error.

mw777eds commented 5 years ago

I cannot figure out what I am doing wrong. I have done a TON of variations. I am going to be doing a presentation on this at our local FMPUG tomorrow. If you have the time I could use help seeing where I am going wrong. I am going to email the server info to you so you can test with my set up to remove any variables there. Again, if you have time...

[{"id":"4c85bfc7.7cb05","type":"tab","label":"Container Data Example Flow","disabled":false,"info":"This flow is an example of using the container data node to retrieve container data from FileMaker's streaming service."},{"id":"4312884a.7c3d78","type":"dapi-list-records","z":"4c85bfc7.7cb05","name":"","client":"628e510d.39603","layout":"payload.layout","layoutType":"msg","limit":"payload.limit","limitType":"msg","offset":"","offsetType":"num","sort":"","sortType":"none","scripts":"","scriptsType":"none","portals":"","portalsType":"none","output":"payload.list","x":290,"y":60,"wires":[["ea86bda9.1fc53"]]},{"id":"25e6b154.ac63fe","type":"inject","z":"4c85bfc7.7cb05","name":"Inject","topic":"","payload":"{\"layout\":\"STU__Students\",\"limit\":\"1\",\"container\":\"fieldData.pic\",\"filename\":\"fieldData.picName\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":60,"wires":[["4312884a.7c3d78"]]},{"id":"cab00b58.bd5258","type":"debug","z":"4c85bfc7.7cb05","name":"debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":730,"y":60,"wires":[]},{"id":"f4b38c37.d5cfb","type":"catch","z":"4c85bfc7.7cb05","name":"errors","scope":null,"x":570,"y":120,"wires":[["cab00b58.bd5258"]]},{"id":"ea86bda9.1fc53","type":"dapi-container-data","z":"4c85bfc7.7cb05","name":"","parameters":"","parameterType":"none","data":"payload.list.data","dataType":"msg","field":"fieldData.pic","fieldType":"msg","filename":"fieldData.picName","filenameType":"msg","destination":"","destinationType":"buffer","output":"payload.containerData.data","x":530,"y":60,"wires":[["cab00b58.bd5258"]]},{"id":"628e510d.39603","type":"dapi-client","z":"","name":"School","timeout":"","concurrency":"1"}]

Luidog commented 5 years ago

@mw777eds I just reached out to you via email. If you can send me credentials for your demo file I would be happy to take a look.

I did notice the last two flows you posted on this issue were invalid. It looks like the inject node's payload may be incorrectly set as a string instead of JSON.

Luidog commented 5 years ago

@mw777eds I believe I have identified the cause of the issue. It looks like in the flow the extract container node is configured to use msg.fieldData.pic instead of fieldData.pic.

The former tells the extract container node to use the value found on the message object at fieldData.pic as the container to extract. Since there is no value at msg.fieldData.pic the url is undefined.

Visual Example

In the above example the container property inside the red square is incorrectly configured since there is no value at msg.fieldData.pic. The filename property inside the blue square is correctly configured to use a string property of fieldData.picName.