orientdb icon indicating copy to clipboard operation
orientdb copied to clipboard

no edge has been created because no source vertices

Open DThink opened this issue 10 years ago • 3 comments

var g = orient.getGraph();
try{
  var user = request.getUser();
  var vertex = 'CREATE VERTEX EventNormal SET created=Date(), updated=Date(), title=?, caption=?';
  var v = g.command('sql', vertex, [title, caption]);
  var erid = v.getRecord().field('@rid');
  var created = v.getRecord().field('created');
  var edge = 'CREATE EDGE NewEventNormal FROM (SELECT FROM OUser WHERE name=?) TO (SELECT FROM EventNormal WHERE @rid=?) SET created=?';
  g.command('sql', edge, [user, erid, created]);
  
  g.commit();
  return v;
}
catch(err){
  g.rollback();
  response.send(500, "Error on creating new user", "text/plain", err.toString() );
} 

sometimes i received this error

{ "error": "com.orientechnologies.orient.core.exception.OCommandExecutionException: No edge has been created because no source vertices\r\n\tDB name="MyApp"" }

now i solved the problem. is not in the transaction but in the login session. i can create a edge only if i logged with a VERTEX user. but sometimes when i open a new schede by the studio dashboard i see that the logged user is not the admin but the root (also if i logged with an admin account). finally the root user not is a VERTEX and is normal that i not can create a edge for this user. the bug is in the login session

DThink avatar Nov 18 '16 21:11 DThink

@DThink

yes if you login with root, that does not have a record in your database, that create edge will fail. Which bug in the login session?

wolf4ood avatar Nov 21 '16 11:11 wolf4ood

when i log with admin or other user different by root, if i open a dashboard link in another browser schede i see that the logged user is the root user

DThink avatar Nov 23 '16 10:11 DThink

@DThink

that i think it's probably caused by the Basic Authentication. Studio and ODB Http relies on that, and i think the browser inject the saved credentials.

wolf4ood avatar Nov 23 '16 11:11 wolf4ood