1
votes

I have created a foxx-application for a app I am working on. I was trying to install the foxx app in arangodb mainline.
I have followed the following steps:
1. create new database from arangosh 'db._createDatabase("databasename")'
2. run command 'foxx-manager --server.database "" fetch directory '
3. then run command 'foxx-manager --server.database "" mount '

But, when I looked at the logs it is giving following error

2014-11-23T04:08:44Z [2584] ERROR Cannot compute Foxx application routes: [ArangoError 1924: graph not found]
2014-11-23T04:08:44Z [2584] ERROR Cannot mount Foxx application 'app:contactspace:1.0': Error: Cannot compute the routing table for Foxx application 'app:contactspace:1.0', check the log file for errors!\n at Object.exports.appRoutes (/usr/share/arangodb/js/server/modules/org/arangodb/foxx/manager.js:1525:15)\n at Object.reloadRouting (/usr/share/arangodb/js/server/modules/org/arangodb/actions.js:1241:38)\n at global context method:1:33\n

I am not able understand the cause of this error. The setup script is running fine after mount but the mount itself is giving error.

The foxx app is working fine in case of arangodb dev instance.

Additional information from here:

Yes I am creating a general graph with only one edge definition. below is the setup.js for that

// load modules
var graph_module = require("org/arangodb/general-graph");

// create graph if does not already exists
var graph = null;
if(!graph_module._exists("sampleGraph")) {
    var containsXRelation = graph_module._directedRelation("containsX", ["X"], ["X"]);
    var edgeDefinitions = graph_module._edgeDefinitions(containsXRelation);
    graph = graph_module._create("sampleGraph", edgeDefinitions);
}
else {
    graph = graph_module._graph("sampleGraph");
}

them some more stuff like creating index's...

Also, I have some graph related code outside the controller actions:

var sampleGraph = graph_module._graph("sampleGraph");
var vertex = contactSpaceGraph._getVertexCollectionByName("contactX");
var edge = contactSpaceGraph._getEdgeCollectionByName("X");
1

1 Answers

3
votes

What you’re doing is what I would have done as well, there are a few little errors in there that lead to the errors:

  • You wrote contactX instead of containsX in the controller
  • You switched the name of the vertex collection and the edge collection in your controller (getVertexCollectionByName should receive X, getEdgeCollectionByName should receive containsX)

If you change those things, you are good to go :) Just tried it locally.

A small remark: In Foxx the idea is that every collection name is prefixed with some information about the mount point. The reason for that is that you should be able to install a Foxx app multiple times without them having a conflict – also multiple apps might have a collection ‘x’ and expect different things to be stored in there. This is why we have applicationContext.collectionName :) I would suggest to use this when you name your graph-related collections as well! If you want to see how it works, I converted your snippets into a simple example app. Here’s the Gist for it:

https://gist.github.com/moonglum/21208befa3ce6227559d