Sorry we could not search the store for annotations

Hi…

I work in IT at Georgia Tech, and one of our Literature faculty has expressed interest in using Annotation Studio in an upcoming class. There are two reasons that she might want to use a local instance rather than the MIT hosted instance: integration with GT’s account and course system (so students avoid dealing with a separate login) and limiting coursework and any other student info to machines under GT’s control. Before we embark on a project to install our own instance, I wonder if there’s been any consideration of federated identity (via SAML or Shibboleth) so that institutional accounts could be used for the MIT-hosted instance. I’m guessing that may be some time in the future, if ever, but I thought I’d ask.

In anticipation that we may need to host an instance, I’ve been working slowly working my way through installation. I’m to the point where I have the data store and the rails application working – at least to the point where I can log into the rails all, see the example doc, etc. But when I load the example document I see the message “Sorry we could not search the store for annotations”.

I see in another thread [ Sorry we could not seach the store for annotations ] mention of the same problem. The suggestion there was to check for a mismatch in credentials between the data store API and the rails app. I’ve checked these in the following cases (I haven’t changed them from the defaults):

in /opt/annotation-studio/config/application.yml
API_CONSUMER: name-of-the-app-on-which-the-annotator-runs
API_SECRET: the-secret-the-annotator-gets-from-the-authorizing-site
API_URL: http://localhost:3000/api

in /opt/annotation-data-store/.env
SECRET=the-secret-the-annotator-gets-from-the-authorizing-site
CONSUMER=name-of-the-app-on-which-the-annotator-runs

So these appear to be the same. I also verified that the api is running and accessible on port 3000 by using telnet.

I’m not sure if I’m overlooking something very basic, or where to look next. I’d be grateful for any pointers. Thanks!

Hi @shodges!

Great to hear that you’re interested in using Annotation Studio!

Couple of questions:

  1. Are you running an instance of the Data Store (https://github.com/hyperstudio/MIT-Annotation-Data-Store)?
  2. Where are you running both the Rails app and the API app? http://localhost:3000/api would only be the right URL when both apps are running locally, and the API on port 3000 and the rails app on some other port. Normally, in production, the URL would be something like http://api.myserver.com/api or whatever.
  3. Have you got MongoDB running, and does the API .env contain the location of that instance of Mongo?

Let me know if none of those ideas helps.

Thanks!

Jamie

Hi Jamie…

Thank you very much for these ideas. I do have a version of the Data Store running – I installed it separately before I realized that Annotation Studio included the data store as well for development purposes. I’ve tried running both the separate version and the included version to see if that makes any difference, but it doesn’t.

At the moment I am indeed running both the Rails app and the data store on the same machine. On that machine, from the command prompt I’ve tested connectivity to mongodb (both with telnet localhost 27017 and with the mongo client), and that seems to work fine. And I’ve tested connectivity to the API with telnet localhost 3000 and GET /api, and that works fine.

I do note that I see no console activity from the API process when working in the Rails application. I assume I should be seeing activity there, so that makes me think Rails doesn’t have the right information for how to connect to the API. I’m including my application.yml below, though it’s basically just the default one.

I’m grateful for any thoughts, or pointers on troubleshooting approaches. Thanks again–

$ cat config/application.yml
development:
RACK_ENV: development
RAILS_ENV: development
API_CONSUMER: name-of-the-app-on-which-the-annotator-runs
API_SECRET: the-secret-the-annotator-gets-from-the
API_URL: http://localhost:3000/api
AWS_ACCESS_KEY_ID: aws_access_key
AWS_SECRET_ACCESS_KEY: aws_secret_access_key
ANNOTATOR_FILTER: false
ANNOTATOR_RICHTEXT: false
ANNOTATOR_RICHTEXT_CONFIG: "undo redo | styleselect | bold italic | link image media | code"
CONFIRMATION_GRACE_PERIOD: 2
DEFAULT_USERS_CAN_CHOOSE_GROUPS: true
DEFAULT_USERS_CAN_CONTROL_PERMISSIONS: true
DEFAULT_USERS_CAN_CREATE_TEXTS: true
DEFAULT_USERS_CAN_SEE_OTHERS_WORK: true
DEFAULT_USER_GROUP: student
ENVIRONMENT_TAG: Development
GMAIL_PASS: gmail_password
GMAIL_USER: gmail_username
GOOGLE_ANALYTICS_CODE: analytics_code
GOOGLE_VERIFICATION_CODE: verification_code
UNICORN_BACKLOG: 16
scope: google_api_stuff
issuer: more_google_api_stuff
DEVISE_SECRET_KEY: super_secret_key
GLOBAL_ALERT: "Global Alert Goes Here. Very important information!"
ALERT_LEVEL: “success”

test:
DEVISE_SECRET_KEY: blah blah
API_CONSUMER: localhost
API_SECRET: heorot-vermonty

Hi @shodges, would you also paste in the .env from the API app you have running?

Thanks!

Jamie

Thanks Jamie – here’s the .env

NODE_ENV=development
PATH=bin:node_modules/.bin:/usr/local/bin:/usr/bin:/bin
PORT=3000
SECRET=the-secret-the-annotator-gets-from-the-authorizing-site
CONSUMER=name-of-the-app-on-which-the-annotator-runs
VERSION=1.0
LIVE_DB=mongodb://localhost/annotationdb
LOCAL_DB=mongodb://localhost/annotationdb
STAGING_DB=mongodb://localhost/annotationdb
DB=mongodb://localhost/annotationdb

I don’t know whether this is useful information, but I notice that if I change the API_URL line in the Rails app’s application.yml to something completely bogus, like

API_URL: http :// blah : 6000 / api

the app still exhibits the same behavior. This makes me wonder if the Rails app is even reading its configuration properly. But, I’m kind of a novice when it comes to Rails, so that may not be a useful diagnostic.

Thanks again for all of your help.

Hi @shodges, and what happens when you load http://localhost:3000/api in the browser?

Hi @jamiefolsom – my installation is on a remote server, so I’m using telnet to test rather than a browser, but it responds in the expected way:

$ telnet localhost 3000
Trying ::1…
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
GET /api

HTTP/1.1 200 OK
X-Powered-By: Express
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Content-Length, Content-Type, Location
Access-Control-Allow-Headers: Content-Length, Content-Type, X-Annotator-Auth-Token, X-Requested-With
Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS
Access-Control-Max-Age: 86400
Content-Type: text/html; charset=utf-8
Content-Length: 26
Date: Thu, 04 Jun 2015 19:39:29 GMT
Connection: close

Annotations API is running

Hi @shodges,

OK, it’s hard to know given the information I have so far, but it sounds to me like your setup might be the source of the issue. Telnet is not a helpful test of the API, unless the API is also available via public HTTP, at for instance http://api.whatever.com/api; that’s how the document makes its requests to the API.

The rails front end (say it’s running at http://localhost:5000/) should be able to issue an HTTP request from the browser to say, http://localhost:3000/api, if that’s where the API is running, and get a response. If it can’t, it will fail to connect.

I hope that helps.

Thanks,

Jamie

Hi @jamiefolsom

The telnet command I mentioned does demonstrate connectivity to the API on port 80 – it’s just a bare-bones way of interacting with the server and manually typing the protocol commands to verify functionality – it’s the equivalent of using a browser for testing.

My gut sense is that I’m not even certain that the Rails app has the correct address for the API – I don’t see any evidence of it even attempting to contact the API. Is there some easy way for me to get the Rails app to echo its configuration, just to verify that it’s reading its configuration properly?

Thanks for all of your help and patience.

Hi @jamiefolsom

After tinkering with some things, annotations are working. I’m not sure exactly what did it, but I wanted to document a couple of things here for posterity. Neither of these changes seem to me like they should have made a difference, so I’m not sure if it was these or something else in the ether.

  1. in application.yml, changed hostname for API_URL from using name localhost to fqdn, e.g.

from
API_URL: http :// localhost : 3000 / api
to
API_URL: http :// blah . gatech . edu : 3000 / api

I’m running both the Rails app and the annotation store on the same server, but with this change, I started seeing the following error in the console for the annotation store server (that provides the api):

11:34:22 web.1 | Error decoding token:
11:34:22 web.1 | [Error: Signature verification failed]
11:34:22 web.1 | Error decoding token:
11:34:22 web.1 | [Error: Signature verification failed]
11:34:22 web.1 | Error decoding token:
11:34:22 web.1 | [Error: Signature verification failed]

  1. So, I made another change – I replaced API_CONSUMER and API_SECRET in application.yml and in the .env file for the annotation data store. I had been using the default that came with the install, and they appeared exactly the same in both places to my eye, but I changed them to

in application.yml:
API_CONSUMER: apiconsumer
API_SECRET: apisecret

and in .env

SECRET=apisecret
CONSUMER=apiconsumer

and then things started working.

Hi @shodges,

Glad that worked, and thanks for documenting your experience.

You’ve reminded me that a changed environment variable requires the API or the Rails app to be restarted, and in some cases, if you remain logged into the rails app, an invalid token could persist across restarts, so perhaps it was one of those things.

Anyhow, glad to hear you got it sorted, and feel free to reach out if you have other questions.

Thanks!

Jamie