1

As far as I understand from reading this snippet in this documentation regarding 'Defining dependencies':

will allow using any app to be used to meet the dependency. sessions or sessions@* will match any app with the name sessions (such as the sessions app in the Foxx application store). sessions@1.0.0 will match the version 1.0.0 of any app with the name sessions.

Foxx will look for any dependency with name 'sessions'. However, when I tried it locally, it seems like it tries to find any app mounted at /sessions rather than name 'sessions' and this error populated in the logs if I use like this format 'sessions@1.0.0':

[ArangoError 3007: Mountpoint can only contain a-z, A-Z, 0-9 or _.]: [object Arguments]

Is this an expected behaviour? I really hope if it's possible to import an app by name rather than the mount point though.

1 Answers1

1

The blurb in the documentation refers to the value in the manifest.json file. Dependencies in the manifest are defined by an alias mapped to a string in the format of <name>@<version>. The exact meaning of that string is not currently enforced so it just serves as documentation for the app.

If you mount an app that has dependencies, you need to set up the dependencies (e.g. using the web frontend). The web frontend's dependencies dialog lets you enter mount paths of apps you want to use to meet the dependencies.

The code of the app itself will then be able to refer to the exports of the apps mounted at those paths by the aliases defined in the manifest.

For example:

  1. You create an app called example with the following dependencies:

    "dependencies": {"mySessions": "sessions@^1.0.0"}
    
  2. You install a sessions app (e.g. the sessions app from the Foxx app store) and mount it at /my-sessions.

  3. You install your example app and mount it somewhere else.

  4. You open the app details of your example app in the web frontend and open the dependencies dialog (boxes icon in the top right).

  5. The dialog should show a single input field titled MySessions with a help popup saying sessions@^1.0.0.

  6. Enter /my-sessions into the input field and save.

  7. Your example app should now be able to access the exports of the app at applicationContext.dependencies.mySessions.

Alan Plum
  • 10,814
  • 4
  • 40
  • 57
  • Thanks a lot for the hint. I guess this should be clarified in the documentation. Somehow it was kinda misleading to some extent. At first, I thought it reads the application name _not_ the mount point. It would be great to have this use case in the documentation/cookbook – Omar Al-Safi Jun 29 '15 at 23:30
  • The documentation says "Dependencies ***can*** be configured from the web interface in a service's settings tab using the Dependencies button." It should say 'Dependencies ***must*** ...' this would have spared me some confusion. Also it should provide a more complete example. – skinneejoe Jun 22 '17 at 15:26