Closed HuntingtonJ closed 2 years ago
This should do the trick: https://github.com/geckosio/phaser-on-nodejs/commit/05278ee8e78d39ab3748073a3876af764946e833
Please try it v1.2.7 works.
Awesome! This fix seemed to do the trick. Issue should be closed.
I call fetch() in my beginGame() to hit a local API to get players to join. This call fails with:
Error on gameReady: TypeError: [object Object] is an url with embedded credentails. at new Request (file:///home/hjasp/repos/neon-towers/backend/server/node_modules/node-fetch/src/request.js:56:10) at file:///home/hjasp/repos/neon-towers/backend/server/node_modules/node-fetch/src/index.js:38:19 at new Promise (<anonymous>) at fetch (file:///home/hjasp/repos/neon-towers/backend/server/node_modules/node-fetch/src/index.js:36:9) at gameReady (file:///home/hjasp/repos/neon-towers/backend/server/src/game/foyerController.js:11:28) at Game.beginGame (file:///home/hjasp/repos/neon-towers/backend/server/src/game/Game.js:35:5) at Server.<anonymous> (file:///home/hjasp/repos/neon-towers/backend/server/index.js:36:14) at Object.onceWrapper (node:events:509:28) at Server.emit (node:events:390:28) at emitListeningNT (node:net:1353:10)
It appears that the it fails in the Request class of node-fetch on the line:
parsedURL = new URL(input);
The parsedURL is empty which seems to be because of lines 24-26 in phaser-on-nodejs/lib/index.js
These line appear to overwrite the actual functionality of new URL().
Commenting out these lines allows the fetch() call to work properly.
What is the purpose of the lines?
I'm fairly new to JS and coding in general.