-
Notifications
You must be signed in to change notification settings - Fork 5
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
literal string "OK" and HTTP status code 200 returned instead of error or JSON #29
Comments
The 200 OK is being generated elsewhere. Completely removing jsonErrors.js reference from app.js does not change the behavior. |
Possibly relevant: We are currently using koa, koa-router. That issue already mentioned in commit history. |
The test suite already has cases that would catch these instances where 404 should be received instead of 200. Seems that the travis docker build / test run provides different results than a local run. Example, all passing: https://travis-ci.org/iDigBio/idigbio-search-api/builds/355542055 but on my laptop I get "text" content type instead of JSON.
|
Travis-CI build services use docker images from: Ours is "different". Some info from the currently running docker container (our prod) which is one of the places where the "OK" problem exists. Outside the container:
Start a shell in the container...
Node environment inside the container:
Unfortunately, cannot currently run tests since they all depend on mock directories existing in places where the www-data user cannot create them.
Inside the container I have no editors, no sudo, or (easy) ability to install an editor. Will try to figure out how to mount / create those directory points for mock. |
Possible big find is that the "node" command inside the travis container maps to node v8.9.1 but "nodejs" maps to v6.13.1. The "test"command is package.json is specified as "NODE_ENV=test BLUEBIRD_DEBUG=1 jest" which does not make it clear which node command is used (v6 or v8). Here is info from inside the travis-ci container:
|
See some quirks: Inside Dockerfile, we are currently installing nodejs from apt. On the travis-ci image, "node" is pre-installed (and I believe is version 8).
|
The travis docker image is based on Trusty (14.04), the idigbio-search-api docker image is based on Xenial (16.04). |
I got the code working on my desktop and began testing again, seems to have something to do with the presence of the NODE_ENV=test environment variable, or if the caching layer / updateLastModified is present. Using url of localhost:19196/v2/search/does-not-exist Yarn start in "prod" mode, get HTTP 200:
Start with NODE_ENV=test, get HTTP 404:
I also noticed that the behavior was "correct" (e.g. giving the 404) when running in prod mode but while a network outage / service disruption was occurring and elasticsearch was not available.
|
"prod" version requires actual redis. So to test "prod" I have to get redis running locally. |
Some requests to search api generate a return of the literal string "OK" rather than a proper JSON response.
It is possible this happens in situation where route does not exist.
The text was updated successfully, but these errors were encountered: