https://www.ory.sh/ logo
a

adamant-breakfast-36508

11/14/2021, 7:19 PM
I'm trying to customize https://github.com/ory/hydra-login-consent-node. In VSCode, it can't use import statements. I'm not terribly familiar with NodeJS. require statements work but objects show up as "any" (problematic if you have strict on). What's the best way to do development?
b

bulky-horse-16303

11/14/2021, 7:42 PM
What do you mean "it can't use import statements"? do you have a TypeScript extension installed in VSCode?
a

adamant-breakfast-36508

11/14/2021, 7:48 PM
Not aside from what's built in. As in "syntax error: cannot use import statement outside a module".
b

bulky-horse-16303

11/14/2021, 7:56 PM
How do you try to run it? I just cloned the repo (Node 16 with yarn), then I ran
yarn install
then
yarn start
, the dev server started and I was able to open the browser, changed some code, refreshed and it went well
?
Did you try, by mistake, to run -
node app.js
a

adamant-breakfast-36508

11/14/2021, 7:57 PM
Yeah, run with node.
b

bulky-horse-16303

11/14/2021, 7:59 PM
The project is written in TypeScript, Node can't natively run it, can you instead run:
npm install
npm run start
See it if starts a web server on port 3000, if it does, try to modify a file and see if it affects
Might be worth to do some Node JS basic TypeScript express tutorial to understand what's going on. Although it's a small project, there is a lot happening under the hood, worth to understand if you plan to use it
a

adamant-breakfast-36508

11/14/2021, 8:02 PM
I did run npm install to build the dependencies.
b

bulky-horse-16303

11/14/2021, 8:03 PM
npm run start
starts a server?
a

adamant-breakfast-36508

11/14/2021, 8:08 PM
Yeah now I seem to be getting somewhere. I had been calling app.ts directly.
👍 1
So my goal is to modify it a bit and use it in production. It seems to have out of date packages/critical vulnerabilities.
I assume I'd have to update and fix and breaking changes?
b

bulky-horse-16303

11/14/2021, 8:26 PM
You may want to update it I guess, give it a try. JS libraries tend to get updated a lot
a

adamant-breakfast-36508

11/14/2021, 8:27 PM
Alright.
One more dumb question: debugging. Figured it out: https://stackoverflow.com/a/67987617/1340075
Alright now I'm getting self signed cert error when hitting the Hydra admin URL. Fixed by directly setting process.env.NODE_TLS_REJECT_UNAUTHORIZED to "0". (Of course, will replace with a valid cert.)
7 Views