nteract / bookstore

📚 Notebook storage and publishing workflows for the masses
https://bookstore.readthedocs.io
BSD 3-Clause "New" or "Revised" License
202 stars 23 forks source link

Publish integration #37

Closed mpacer closed 5 years ago

mpacer commented 5 years ago

This adds functionality for publishing Notebooks to ci-published and then to compare what is stored there against our in memory copy.

Also adds an integration test for that functionality.

mpacer commented 5 years ago

Ok so it's definitely the publishNotebook xhr request that is off, so I'm going to try to iterate on that in python for a bit.

mpacer commented 5 years ago

So the problem was that we hadn't enabled the serverextension on CI, and it doesn't currently happening automatically (currently working on a PR to fix this).

I added it to the README as well as to the CI and now it works gloriously.

The reason it caused a problem is that the request was expecting JSON back, but because the endpoint wasn't valid, the server was returning a 404 response with an html page.

It'd be nice if we could have a better error than

unhandledRejection SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)

but there may be other reasons why that could occur and it would be overkill to build something special purpose for this case.

But I figure that this is a good place to document that if anyone else runs into Unexpected token < in JSON at position 0, a good first guess is that it's getting an html page instead of a JSON object… and that might be because you're hitting an endpoint that the server doesn't think exists.

rgbkrk commented 5 years ago

Thanks for taking this through the paces @mpacer!