illinois / queue

A microservice queue for holding open office hours
University of Illinois/NCSA Open Source License
82 stars 36 forks source link

Fix startup #324

Closed nwalters512 closed 3 years ago

nwalters512 commented 4 years ago

This PR fixes the startup of the queue in local development. This was tested with Node 12. Note that until https://github.com/mapbox/node-sqlite3/issues/1314 is resolved, the Queue will not support Node 14.

With these changes, one should be able to run the queue with just npm install && npm run dev.

vercel[bot] commented 4 years ago

This pull request is being automatically deployed with Vercel (learn more). To see the status of your deployment, click below or on the icon next to each commit.

echuber2 commented 4 years ago

Hm, I think the version bump in https://github.com/illinois/queue/pull/324/commits/7d1bda3a5e1f61059a88d899cac4bb3a0cf3f4e1 introduced a regression.

Trying it on node 12, with this branch and everything up through commit https://github.com/illinois/queue/pull/324/commits/2d6fc9fa2b923f2a0e98262fee24e5293f28f523, it works. But with the latest commit, I get this error message when I do npm run dev:

> queue@2.0.0 dev /home/jovyan/queue
> ts-node --type-check --compiler-options '{"module":"commonjs"}' src/server.ts

/home/jovyan/queue/node_modules/ts-node/src/index.ts:240
    return new TSError(diagnosticText, diagnosticCodes)
           ^
TSError: ⨯ Unable to compile TypeScript:
src/server.ts:21:17 - error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'typeof import("/home/jovyan/queue/node_modules/next/types/index")' has no compatible call signatures.

21 const nextApp = nextJs({ dev: DEV, dir: DEV ? 'src' : 'build', quiet: true })
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    at createTSError (/home/jovyan/queue/node_modules/ts-node/src/index.ts:240:12)
    at reportTSError (/home/jovyan/queue/node_modules/ts-node/src/index.ts:244:19)
    at getOutput (/home/jovyan/queue/node_modules/ts-node/src/index.ts:360:34)
    at Object.compile (/home/jovyan/queue/node_modules/ts-node/src/index.ts:393:11)
    at Module.m._compile (/home/jovyan/queue/node_modules/ts-node/src/index.ts:439:43)
    at Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
    at Object.require.extensions.<computed> [as .ts] (/home/jovyan/queue/node_modules/ts-node/src/index.ts:442:12)
    at Module.load (internal/modules/cjs/loader.js:879:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! queue@2.0.0 dev: `ts-node --type-check --compiler-options '{"module":"commonjs"}' src/server.ts`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the queue@2.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

(Yep, it's user jovyan because I'm testing this in a Jupyter image I had lying around...)

After googling the error message, it seems like newer versions of Next aren't backwards compatible with the type signatures that were being used before (or maybe Next has them built in now, since types/next seems to be deprecated). However I wasn't able to get it to work just by bumping Next to the newest major version optimistically.