Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Found class name null or empty #116

Closed
tommykennedy opened this issue Jul 1, 2015 · 10 comments
Closed

Found class name null or empty #116

tommykennedy opened this issue Jul 1, 2015 · 10 comments

Comments

@tommykennedy
Copy link
Contributor

Hi Dario,

I am running the following code below on sails-orientdb v0.10.55. I get the error below. I have played around with the answer variable and the length of the object name seems to cause it. The Answer parameter is of type JSON.

OrientDB Server v2.1-rc4
Oriento 1.1.3

Any ideas?

Tom

    var answer = {binaryanswer:'yes'};
    console.log(answer);

    Answer.create({
        question: req.param('id'),
        Answer: answer
    }, function (err, quest) {
        console.log(err);
        if (err) return res.send(500, err);

        console.log("This was ok");
    });

Error (E_UNKNOWN) :: Encountered an unexpected error

OrientDB.RequestError: Found class name null or empty

at Operation.parseError (/Users/thomaskenedy/sandbox/LegoSix/node_modules/oriento/lib/transport/binary/protocol28/operation.js:832:13)

at Operation.consume (/Users/thomaskenedy/sandbox/LegoSix/node_modules/oriento/lib/transport/binary/protocol28/operation.js:422:35)

at Connection.process (/Users/thomaskenedy/sandbox/LegoSix/node_modules/oriento/lib/transport/binary/connection.js:360:17)

at Connection.handleSocketData (/Users/thomaskenedy/sandbox/LegoSix/node_modules/oriento/lib/transport/binary/connection.js:279:17)

at Socket.emit (events.js:107:17)

at readableAddChunk (_stream_readable.js:163:16)

at Socket.Readable.push (_stream_readable.js:126:10)

at TCP.onread (net.js:538:20)

From previous event:

at Connection._sendOp (/Users/thomaskenedy/sandbox/LegoSix/node_modules/oriento/lib/transport/binary/connection.js:79:10)

at Connection.send (/Users/thomaskenedy/sandbox/LegoSix/node_modules/oriento/lib/transport/binary/connection.js:63:17)

at BinaryTransport.send (/Users/thomaskenedy/sandbox/LegoSix/node_modules/oriento/lib/transport/binary/index.js:191:43)

at Server.send (/Users/thomaskenedy/sandbox/LegoSix/node_modules/oriento/lib/server/index.js:112:25)

at Db.<anonymous> (/Users/thomaskenedy/sandbox/LegoSix/node_modules/oriento/lib/db/index.js:152:24)

at processImmediate [as _immediateCallback] (timers.js:358:17)

From previous event:

at Db.send (/Users/thomaskenedy/sandbox/LegoSix/node_modules/oriento/lib/db/index.js:144:4)

at Db.exec (/Users/thomaskenedy/sandbox/LegoSix/node_modules/oriento/lib/db/index.js:247:22)

at Db.query (/Users/thomaskenedy/sandbox/LegoSix/node_modules/oriento/lib/db/index.js:279:15)

at module.exports.Statement.extend.exec (/Users/thomaskenedy/sandbox/LegoSix/node_modules/oriento/lib/db/query.js:108:20)

at module.exports.Statement.extend.all (/Users/thomaskenedy/sandbox/LegoSix/node_modules/oriento/lib/db/query.js:70:17)

at update (/Users/thomaskenedy/sandbox/LegoSix/node_modules/sails-orientdb/lib/collection/document.js:201:6)

at Connection.update (/Users/thomaskenedy/sandbox/LegoSix/node_modules/sails-orientdb/lib/connection.js:381:32)

at Object.module.exports.adapter.update (/Users/thomaskenedy/sandbox/LegoSix/node_modules/sails-orientdb/lib/adapter.js:309:38)

at module.exports.update (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/adapter/dql.js:239:13)

at bound.updateRecords (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/query/dql/update.js:197:16)

at /usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/query/dql/update.js:52:21

at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:254:17

at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:157:25

at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:251:21

at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:615:34

at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:157:25

at bound.<anonymous> (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/utils/schema.js:151:44)

at fn (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/utils/callbacksRunner.js:79:10)

at iterate (/usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:149:13)

at Object.async.eachSeries (/usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:165:9)

at Object.runner.beforeUpdate (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/utils/callbacksRunner.js:82:9)

at /usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/query/dql/update.js:165:17

From previous event:

at insert (/Users/thomaskenedy/sandbox/LegoSix/node_modules/sails-orientdb/lib/collection/document.js:149:6)

at Connection.create (/Users/thomaskenedy/sandbox/LegoSix/node_modules/sails-orientdb/lib/connection.js:373:32)

at Object.module.exports.adapter.create (/Users/thomaskenedy/sandbox/LegoSix/node_modules/sails-orientdb/lib/adapter.js:300:38)

at module.exports.create (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/adapter/dql.js:85:13)

at bound.createValues (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/query/dql/create.js:213:16)

at /usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/query/dql/create.js:74:20

at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:254:17

at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:157:25

at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:251:21

at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:615:34

at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:157:25

at bound.<anonymous> (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/utils/schema.js:151:44)

at fn (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/utils/callbacksRunner.js:41:10)

at iterate (/usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:149:13)

at Object.async.eachSeries (/usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:165:9)

at Object.runner.beforeCreate (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/utils/callbacksRunner.js:44:9)

at /usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/query/dql/create.js:179:17

at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:610:21

at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:249:17

at iterate (/usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:149:13)

at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:160:25

at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:251:21

at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:615:34

at /usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/query/validate.js:71:7

at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:254:17

at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:157:25

at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:251:21

at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:615:34

at /usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/query/validate.js:65:11

at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:157:25

at /usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/query/validate.js:59:13

at /usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/utils/schema.js:151:44

at runner (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/query/validate.js:57:11)

at iterate (/usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:149:13)

at Object.async.eachSeries (/usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:165:9)

at /usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/query/validate.js:63:15

at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:610:21

From previous event:

at find (/Users/thomaskenedy/sandbox/LegoSix/node_modules/sails-orientdb/lib/collection/document.js:114:6)

at Connection.find (/Users/thomaskenedy/sandbox/LegoSix/node_modules/sails-orientdb/lib/connection.js:344:32)

at Object.module.exports.adapter.find (/Users/thomaskenedy/sandbox/LegoSix/node_modules/sails-orientdb/lib/adapter.js:292:38)

at module.exports.find (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/adapter/dql.js:121:13)

at module.exports.findOne (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/adapter/dql.js:161:10)

at _runOperation (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/query/finders/operations.js:400:29)

at run (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/query/finders/operations.js:69:8)

at bound.module.exports.findOne (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/query/finders/basic.js:66:16)

at bound [as findOne] (/usr/local/lib/node_modules/sails/node_modules/lodash/dist/lodash.js:729:21)

at /Users/thomaskenedy/sandbox/LegoSix/api/services/passport.js:403:10

at pass (/Users/thomaskenedy/sandbox/LegoSix/node_modules/passport/lib/authenticator.js:353:9)

at Authenticator.deserializeUser (/Users/thomaskenedy/sandbox/LegoSix/node_modules/passport/lib/authenticator.js:358:5)

at Authenticator.bound [as deserializeUser] (/usr/local/lib/node_modules/sails/node_modules/lodash/dist/lodash.js:729:21)

at SessionStrategy.authenticate (/Users/thomaskenedy/sandbox/LegoSix/node_modules/passport/lib/strategies/session.js:49:28)

at attempt (/Users/thomaskenedy/sandbox/LegoSix/node_modules/passport/lib/middleware/authenticate.js:341:16)

at authenticate (/Users/thomaskenedy/sandbox/LegoSix/node_modules/passport/lib/middleware/authenticate.js:342:7)

at /Users/thomaskenedy/sandbox/LegoSix/api/policies/passport.js:43:23

at initialize (/Users/thomaskenedy/sandbox/LegoSix/node_modules/passport/lib/middleware/initialize.js:62:5)

at module.exports (/Users/thomaskenedy/sandbox/LegoSix/api/policies/passport.js:41:24)

at routeTargetFnWrapper (/usr/local/lib/node_modules/sails/lib/router/bind.js:179:5)

at callbacks (/usr/local/lib/node_modules/sails/node_modules/express/lib/router/index.js:164:37)

at param (/usr/local/lib/node_modules/sails/node_modules/express/lib/router/index.js:138:11)

at pass (/usr/local/lib/node_modules/sails/node_modules/express/lib/router/index.js:145:5)

at nextRoute (/usr/local/lib/node_modules/sails/node_modules/express/lib/router/index.js:100:7)

at callbacks (/usr/local/lib/node_modules/sails/node_modules/express/lib/router/index.js:167:11)

at /usr/local/lib/node_modules/sails/lib/router/bind.js:187:7

at clearHeaders (/usr/local/lib/node_modules/sails/lib/hooks/cors/index.js:209:3)

at routeTargetFnWrapper (/usr/local/lib/node_modules/sails/lib/router/bind.js:179:5)

at callbacks (/usr/local/lib/node_modules/sails/node_modules/express/lib/router/index.js:164:37)

at param (/usr/local/lib/node_modules/sails/node_modules/express/lib/router/index.js:138:11)

at pass (/usr/local/lib/node_modules/sails/node_modules/express/lib/router/index.js:145:5)

at nextRoute (/usr/local/lib/node_modules/sails/node_modules/express/lib/router/index.js:100:7)

at callbacks (/usr/local/lib/node_modules/sails/node_modules/express/lib/router/index.js:167:11)

at /usr/local/lib/node_modules/sails/lib/router/bind.js:187:7

at sails.router.bind._middlewareType (/usr/local/lib/node_modules/sails/lib/hooks/csrf/index.js:102:11)

at routeTargetFnWrapper (/usr/local/lib/node_modules/sails/lib/router/bind.js:179:5)

at callbacks (/usr/local/lib/node_modules/sails/node_modules/express/lib/router/index.js:164:37)

Details: OrientDB.RequestError: Found class name null or empty

@dmarcelino
Copy link
Member

Hello @tommykennedy, do you get the same with OrientDB 2.0.x? Sails-orientDB does not support OrientDB 2.1 yet, check #52.

@tommykennedy
Copy link
Contributor Author

No I checked it on 2.0.5-snapshot and it also came up with the error. Is there a problem with passing in a Javascript Object to the create method? Is it expecting a string?

@dmarcelino
Copy link
Member

Is there a problem with passing in a Javascript Object to the create method?

There shouldn't be as sails-orientdb passes the json type test which is not too different from what you are doing. Is this schemaful or schemaless btw?

@tommykennedy
Copy link
Contributor Author

The Answer model is defined as

module.exports = {

tableName: 'Answer',
identity: 'Answer',

attributes: {
    id: {
        type: 'string',
        primaryKey: true,
        columnName: '@rid'
    },
    Answer: {
        type: 'JSON'
    },
    question: {
        collection: 'Questions',
        via: 'answers',
    }
}

};

so I would say Schemaful if my understanding is correct.

@dmarcelino
Copy link
Member

BTW, this is probably not the cause of your issue but the identity (and collection) of a model must be lower case: docs

@tommykennedy
Copy link
Contributor Author

I commented out the identity tags and that didn't make a difference. I have attached both models. They are joined by an edge relationship. I think this is where the issue lies.

Found class name null or empty is still coming up and the edge does not get created.

Answer

module.exports = {

tableName: 'Answer',
//identity: 'answer',

attributes: {
    id: {
        type: 'string',
        primaryKey: true,
        columnName: '@rid'
    },
    Answer: {
        type: 'JSON'
    },
    question: {
        collection: 'questions',
        via: 'answers',
    }
}

};

and Question

 module.exports = {
 tableName: 'Questions',
 //identity:'questions',
 joinTableNames: {
  answers: 'answered'
 },

 attributes: {
   id: { type: 'string', primaryKey: true, columnName: '@rid'},
   question  : { type: 'string'},
   answers: {
  collection: 'answer',
  via: 'question',
  dominant:true
  }
}
};

I enabled Oriento Logging and the output gives.

executing query against db waterlineTest: INSERT INTO Answer SET Answer = :paramAnswer0, createdAt = :paramcreatedAt1, updatedAt = :paramupdatedAt2
sending operation command for database waterlineTest
executing query against db waterlineTest: UPDATE Answer SET Answer = :paramAnswer0, createdAt = :paramcreatedAt1, updatedAt = :paramupdatedAt2, @Rid = :paramrid3 RETURN AFTER WHERE @Rid = :param0
sending operation command for database waterlineTest

@dmarcelino
Copy link
Member

@tommykennedy, would you mind submitting a PR with a test? You can use 105-delete_customPK.js as a template.

@tommykennedy
Copy link
Contributor Author

I haven't written any tests before but now is the time to learn. Let me look at the template and attempt it. Are there any docs?

@tommykennedy
Copy link
Contributor Author

Hi Dario,

I have submitted a failing test.

Tom

dmarcelino added a commit that referenced this issue Jul 10, 2015
dmarcelino added a commit that referenced this issue Jul 10, 2015
… it's null or empty to allow user's submitted classes
tommykennedy added a commit to tommykennedy/sails-orientdb that referenced this issue Jul 10, 2015
appscot#116: attempt to fix error on edge creation
@dmarcelino
Copy link
Member

Fixed via #119.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants