0

I am trying to get the ORION-Broker running with IoTA-LoRa. Unfortunately I get an Error-Message while trying to add a device to the Agent.

I use the following HowTo to use TheThingsNetwork: https://fiware-lorawan.readthedocs.io/en/latest/users_manual/index.html#the-things-network-ttn

Does anyone got it running? I always get the error: Cannot read property 'findOne' of undefined.

Any Ideas of solving it?

Payload and Error-Message

Unfortunately a restart of IoTA does not work.

This is my Docker-compose file:

Unfortunately it is not working for me. Following I Post my Docker-compose file:

version: "3.1
services:

mongodb:
    image: mongo:latest
    hostname: mongo-db
    container_name: db-mongo
    ports:
        - "27017:27017"
    volumes:
        - /mnt/docker/mongodb:/data

orion:
    image: fiware/orion
    hostname: orion
    container_name: fiware-orion
    depends_on:
        - mongodb
    expose:
        - "1026"
    ports:
        - "1026:1026"
    command: -dbhost mongodb

iot-agent:
    image: ioeari/iotagent-lora
    hostname: iot-agent
    container_name: fiware-iot-agent
    depends_on:
        - mongodb
    expose:
        - "4041"
    ports:
        - "4041:4041"
    environment:
        - "IOTA_CB_HOST=orion"
        - "IOTA_CB_PORT=1026"
        - "IOTA_NORTH_PORT=4041"
        - "IOTA_REGISTRY_TYPE=mongodb"
        - "IOTA_MONGO_HOST=mongo-db"
        - "IOTA_MONGO_PORT=27017"
        - "IOTA_MONGO_DB=iotagent-lorawan"
        - "IOTA_PROVIDER_URL=http://iot-agent:4041"

I try to add a Device like it is described in the FIWARE-HowTo in the above link.

The IoTA in general is running. The call: http://myhost:4041/iot/about works fine. But operating devices with it always fails.

And here is the full error message:

HTTP/1.1 500 Internal Server Error X-Powered-By: Express Fiware-Correlator: c430da57-9b39-4ef1-a7e7-f27f2e6b2113 Content-Type: application/json; charset=utf-8 Content-Length: 76 ETag: W/"4c-Mk5iR3/t76SWs53TC2DG+2Oquj0" Date: Tue, 17 Sep 2019 08:14:03 GMT Connection: close

{"name":"TypeError","message":"Cannot read property 'findOne' of undefined"}

2 Answers 2

1

The error message indicates a Mongo-DB problem, but I think this maybe Docker related, specifically an image versioning issue.

mongodb:
    image: mongo:latest

orion:
    image: fiware/orion

iot-agent:
    image: ioeari/iotagent-lora

In each case you are explicitly or implicitly using the bleeding-edge latest Docker image, for example in the case of mongo-db this is currently mongo:4.2.0, maybe it was something else yesterday, maybe there is a breaking change since the LoRaWAN IoT Agent was last updated.

It would be better to fix to using the common set of builds used at the time of the FIWARE_7.7.1 release:

  • fiware/orion:2.2.0
  • mongo:3.6
  • fiware/iotagent-lorawan:1.2.3

And try again to see Mongo-DB is better behaved.

Note: It looks like version tags are missing on ioeari/iotagent-lora, but latest corresponds to bff2c15d which was release 1.2.1 which has not yet been duplicated in the FIWARE account. For certainty, it could be better to build your own from sources.

Second point - your "IOTA_MONGO_HOST=mongo-db" and Orion connection command command: -dbhost mongodb do not match try the following:

version: "3.1"

services:
    iot-agent:
        image: fiware/iotagent-lorawan:1.2.2
        hostname: iot-agent
        container_name: fiware-iot-agent
        depends_on:
            - mongo-db
        expose:
            - "4041"
        ports:
            - "4041:4041"
        environment:
            - "IOTA_CB_HOST=orion"
            - "IOTA_CB_PORT=1026"
            - "IOTA_NORTH_PORT=4041"
            - "IOTA_REGISTRY_TYPE=mongodb"
            - "IOTA_MONGO_HOST=mongo-db"
            - "IOTA_MONGO_PORT=27017"
            - "IOTA_MONGO_DB=iotagent-lorawan"
            - "IOTA_PROVIDER_URL=http://iot-agent:4041"
            - IOTA_LOG_LEVEL=DEBUG # The log level of the IoT Agent

    mongo-db:
        image: mongo:3.6
        hostname: mongo-db
        container_name: db-mongo
        expose:
            - "27017"
        ports:
            - "27017:27017"
        command: --bind_ip_all --smallfiles
        volumes:
            - mongo-db:/data

    orion:
        image: fiware/orion
        hostname: orion
        container_name: fiware-orion
        depends_on:
            - mongo-db
        expose:
            - "1026"
        ports:
            - "1026:1026"
        command: -dbhost mongo-db

volumes:
    mongo-db: ~

One or other of your mongo-db connections is failing, this will cause mongoose to have a null pointer.

3
  • There is a missing Manifest for the 1.2.1 ERROR: for iot-agent manifest for fiware/iotagent-lorawan:1.2.1 not found: manifest unknown: manifest unknown ERROR: manifest for fiware/iotagent-lorawan:1.2.1 not found: manifest unknown: manifest unknown Sep 17, 2019 at 12:31
  • Try fiware/iotagent-lorawan:1.2.0 for now. I'll investigate the 1.2.1 build.
    – Jason Fox
    Sep 17, 2019 at 12:41
  • Builds 1.2.1, 1.2.2 and 1.2.3 are now available.
    – Jason Fox
    Sep 17, 2019 at 17:31
0

The error Cannot read property 'findOne' of undefined generally in FIWARE environment setup arises because of synchronization problem between IoT Agent and MongoDB.

In our case we also had this problem multiple times, the idea is to start the MongoDB first and then start IoT Agent, and if MongoDB is restarted, sometimes we have to restart the IoT Agent again after MongoDB.

1
  • Unfortunately this approach is not working in my case :-( Sep 17, 2019 at 8:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.