Skip to content
This repository was archived by the owner on Sep 2, 2020. It is now read-only.
This repository was archived by the owner on Sep 2, 2020. It is now read-only.

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'model' of undefined #31

Description

@awatson1978

Hello,
So, I have the ECQM Engine running successfully, with both MongoDB and RabbitMQ, using node bin/rabbit_worker.js.

However, I'm receiving the following errors when I try to run the jasmine tests using npm run-script test:

FF(node:97426) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'model' of undefined
    at Handler.finish (/Volumes/StorageCrystal-Quartz/Code/MITRE/js-ecqm-engine/lib/handlers/cypress_mongo_handler.js:34:41)
    at UserContext.it (/Volumes/StorageCrystal-Quartz/Code/MITRE/js-ecqm-engine/spec/handlers/cypress_mongo_handler_spec.js:63:13)
    at attempt (/Volumes/StorageCrystal-Quartz/Code/MITRE/js-ecqm-engine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4478:46)
    at QueueRunner.run (/Volumes/StorageCrystal-Quartz/Code/MITRE/js-ecqm-engine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4402:20)
    at QueueRunner.execute (/Volumes/StorageCrystal-Quartz/Code/MITRE/js-ecqm-engine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4384:10)
    at Spec.queueRunnerFactory (/Volumes/StorageCrystal-Quartz/Code/MITRE/js-ecqm-engine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:964:35)
    at Spec.execute (/Volumes/StorageCrystal-Quartz/Code/MITRE/js-ecqm-engine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:563:10)
    at UserContext.fn (/Volumes/StorageCrystal-Quartz/Code/MITRE/js-ecqm-engine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:5541:37)
    at attempt (/Volumes/StorageCrystal-Quartz/Code/MITRE/js-ecqm-engine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4486:26)
    at QueueRunner.run (/Volumes/StorageCrystal-Quartz/Code/MITRE/js-ecqm-engine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4402:20)
    at QueueRunner.execute (/Volumes/StorageCrystal-Quartz/Code/MITRE/js-ecqm-engine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4384:10)
    at queueRunnerFactory (/Volumes/StorageCrystal-Quartz/Code/MITRE/js-ecqm-engine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:964:35)
    at UserContext.fn (/Volumes/StorageCrystal-Quartz/Code/MITRE/js-ecqm-engine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:5526:13)
    at attempt (/Volumes/StorageCrystal-Quartz/Code/MITRE/js-ecqm-engine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4486:26)
    at QueueRunner.run (/Volumes/StorageCrystal-Quartz/Code/MITRE/js-ecqm-engine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4402:20)
    at runNext (/Volumes/StorageCrystal-Quartz/Code/MITRE/js-ecqm-engine/node_modules/jasmine-core/lib/jasmine-core/jasmine.js:4446:20)
(node:97426) 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(). (rejection id: 1)
(node:97426) [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.

Further down the page, we're also receiving the following:

**Failures:
1) A Javascript CQL Calculation Executor encountered a declaration exception
  Message:
    TypeError: connection.model is not a function
  Stack:
    TypeError: connection.model is not a function
        at new MongoDBMeasureSource (/Volumes/StorageCrystal-Quartz/Code/MITRE/js-ecqm-engine/lib/models/measure_source.js:6:34)
        at new Executor (/Volumes/StorageCrystal-Quartz/Code/MITRE/js-ecqm-engine/lib/executor.js:13:26)
        at Suite.describe (/Volumes/StorageCrystal-Quartz/Code/MITRE/js-ecqm-engine/spec/executor_spec.js:11:20)
        at Object.<anonymous> (/Volumes/StorageCrystal-Quartz/Code/MITRE/js-ecqm-engine/spec/executor_spec.js:9:1)
        at Module._compile (internal/modules/cjs/loader.js:689:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
        at Module.load (internal/modules/cjs/loader.js:599:32)
        at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
        at Function.Module._load (internal/modules/cjs/loader.js:530:3)
        at Module.require (internal/modules/cjs/loader.js:637:17)
        at require (internal/modules/cjs/helpers.js:20:18)
        at /Volumes/StorageCrystal-Quartz/Code/MITRE/js-ecqm-engine/node_modules/jasmine/lib/jasmine.js:93:5
        at Array.forEach (<anonymous>)
**

Are there any extra command options we're suppose to be using when running the jasmine tests? I've tried using a environment variables such as NODE_ENV=test node bin/rabbit_worker.js.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions