-
Notifications
You must be signed in to change notification settings - Fork 49
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
Auspice dev server broken #616
Comments
I spoke too soon regarding the temporary solution above. There are other broken components beyond the CJS to ESM conversion. Attempting to load datasets results in a (charon) API call which fails as our handlers are now designed in such a way that they rely on middleware and thus don't work when running the dev server:
|
EDIT: I also spoke too soon... I had something else running in the background thinking it was working. The output makes it look like it does, but it hangs and does not actually start the server.
|
As you mentioned, this comes down to Auspice's CJS code trying to Based on nodejs/modules#454, I don't think what we're looking to do is supported. Two long-term options:
|
A way of explaining this is to compare it with our normal nextstrain.org usage. There we first have a build stage to compile the auspice client (with customisations) into an index.html entrypoint and some JS bundles, a process which uses For developing the auspice client in the context of nextstrain.org, we want to incrementally update the client code as we change things rather than rebuilding it (⌛), and The nextstrain.org server has come a long way since I first built it, and it may not make sense to use this development direction as (a) we've moved to ESM and (b) our API handlers are much more complex than the ones an auspice server expects. We also don't use auspice cusomisations as much as we used to, as we now route more pages to Gatsby whereas previously we would use the (custom) auspice splash page. Regardless, we should have a nicer path to auspice development work than we do now where one has to rebuild the auspice client each time we want to test a change. |
I'd recommend taking the same approach I used to integrate the Gatsby dev server into the nextstrain.org codebase. The gist is that we'd run Lines 5 to 9 in b68e829
Line 74 in b68e829
Lines 422 to 444 in b68e829
nextstrain.org/src/endpoints/static.js Lines 81 to 119 in b68e829
|
Nextstrain.org uses a customised version of auspice, typically built via
./build.sh auspice
or similar. We also allow the use of auspice's dev server in order to develop these customisations. This dev server is provided with both client-side customisation code as well as custom endpoints to handle the API requests made from the auspice client so that we can mimic nextstrain.org behavior. (By the way - these endpoints in./src/endpoints/charon/index.js
were specifically exposed in a single file to allow this; see Supplying custom handlers to the Auspice server for background.)Since our migration from CJS to ESM (PR #583 and others) the dev server no longer works:
Temporary solution
Branching off 7737fad (the last commit before the CJS to ESM conversion) allows the dev server to work. Working from this should be ok for the ideas I'm testing out at the moment.
Long term Solution
I imagine this is going to be solved by changing the auspice server code, as that's what's importing the handlers. Ideally this would be a backwards compatible change. @victorlin is it possible to allow importing CJS and ESM code?
The text was updated successfully, but these errors were encountered: