christopherjnelson / Arcadyan-5G-Web-Admin

Web App for T-Mobile Arcadyan KVD21 5G Gateway
65 stars 17 forks source link

Failure to launch. Browser messages follow: #1

Closed arnstein99 closed 2 years ago

arnstein99 commented 2 years ago

Compiled with problems:X

ERROR

[eslint] Must use import to load ES Module: /Users/David/git/Arcadyan-5G-Web-Admin/node_modules/@eslint/eslintrc/universal.js require() of ES modules is not supported. require() of /Users/David/git/Arcadyan-5G-Web-Admin/node_modules/@eslint/eslintrc/universal.js from /Users/David/git/Arcadyan-5G-Web-Admin/node_modules/eslint/lib/linter/linter.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename universal.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/David/git/Arcadyan-5G-Web-Admin/node_modules/@eslint/eslintrc/package.json.

ERROR

Error: Child compilation failed: [eslint] Must use import to load ES Module: /Users/David/git/Arcadyan-5G-Web-A dmin/node_modules/@eslint/eslintrc/universal.js require() of ES modules is not supported. require() of /Users/David/git/Arcadyan-5G-Web-Admin/node_modules/@eslint/eslin trc/universal.js from /Users/David/git/Arcadyan-5G-Web-Admin/node_modules/esli nt/lib/linter/linter.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename universal.js to end in .cjs, change the requiring code to use i mport(), or remove "type": "module" from /Users/David/git/Arcadyan-5G-Web-Admi n/node_modules/@eslint/eslintrc/package.json.

christopherjnelson commented 2 years ago

Do you have the most recent version of Node installed? I just setup my dev environment 5 days ago and have the latest everything running. Quick google search looks like this is an ESLINT issue with the way things are imported.

https://stackoverflow.com/questions/69554485/eslint-error-must-use-import-to-load-es-module

arnstein99 commented 2 years ago

I installed node.js v18.9.0 and that got me a little further.

Compiled successfully!

You can now view kvd_web in the browser.

  Local:            http://localhost:3000
  On Your Network:  http://192.168.0.140:3000

Note that the development build is not optimized.
To create a production build, use npm run build.

webpack compiled successfully
Proxy error: Could not proxy request /TMI/v1/auth/login from localhost:3000 to http://192.168.12.1:80.
See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ETIMEDOUT).

This is on MacOS 12.5.1, which is the latest version.

christopherjnelson commented 2 years ago

Are you using an another router behind the gateway? Your subnet is different than the gateway and I think it's causing issues with the node proxy server (required to bypass CORS). I haven't tested anything other than directly hooking into the gateway itself.

I appreciate your help with the debugging!

arnstein99 commented 2 years ago

You are correct. I have these wired connections: (iMac computer) <----> (Asus router) <----> (Arcadyan appliance)

christopherjnelson commented 2 years ago

I'll have to figure out a way around that, as I'm still kind green when it comes to how the node proxy server works. If you hook right into your gateway directly, retrieve an IP on the gateways subnet and re-launch the project it should work.

I'll do some research tonight to see if there is a better way to bypass CORS as I'm sure there will be some issues when trying to push this into production.

arnstein99 commented 2 years ago

If it helps, I can tell you that from my desktop computer I am able to interrogate the Arcaydan appliance. In particular, I can issue this command

wget 'http://192.168.12.1/TMI/v1/gateway?get=all' --output-document=-

the Arcaydan appliance responds with a nice status report.

christopherjnelson commented 2 years ago

Any HTTP requests that send data to the gateway requires the proxy server to bypass CORS unfortunately. I'll figure out a better solution this evening.

christopherjnelson commented 2 years ago

If you get a free moment, can you confirm the web app works when connected directly to the gateway?

christopherjnelson commented 2 years ago

If you want to go ahead and clone the repo again and run it, the new proxy solution I just pushed may fix your issues as well.

arnstein99 commented 2 years ago

I used git commit 1da9729dea85555630fe3223d8348343df65e60f and I got a bit further. I could enter my password, but then the "Loading" throbber throbs forever. I captured the output from npm start using script:

Script started on Thu Sep  8 16:05:22 2022
^[]2;  [imac3:/Users/David/git/Arcadyan-5G-Web-Admin]^G^[A^[]1;^G^[A^M
The default interactive shell is now zsh.^M
To update your account to use zsh, please run `chsh -s /bin/zsh`.^M
For more details, please visit https://support.apple.com/kb/HT208050.^M
^[[?1034himac3 500> npm start^M
^M
> kvd_web@0.1.0 start^M
> react-scripts start^M
^M
[HPM] Proxy created: /  -> http://192.168.12.1/TMI/v1/^M
[HPM] Proxy rewrite rule created: "^/api" ~> ""^M
(node:60731) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.^M
(Use `node --trace-deprecation ...` to show where the warning was created)^M
(node:60731) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.^M
^[[2J^[[3J^[[H^[[36mStarting the development server...^[[39m^M
^[[36m^[[39m^M
^[[2J^[[3J^[[H^[[32mCompiled successfully!^[[39m^M
^M
You can now view ^[[1mkvd_web^[[22m in the browser.^M
^M
  ^[[1mLocal:^[[22m            http://localhost:^[[1m3000^[[22m^M
  ^[[1mOn Your Network:^[[22m  http://192.168.0.140:^[[1m3000^[[22m^M
^M
Note that the development build is not optimized.^M
To create a production build, use ^[[36mnpm run build^[[39m.^M
^M
webpack compiled ^[[1m^[[32msuccessfully^[[39m^[[22m^M
^C^M
imac3 501> exit^M

Script done on Thu Sep  8 16:05:48 2022
christopherjnelson commented 2 years ago

I forgot to add a timeout for login, thus the lack of any kind of error when logging in -- I will fix that in the next commit.

Unfortunately that means that it's still having an issue utilizing the proxy when you're on a separate subnet. I'll continue to look into this issue. Thanks again.

arnstein99 commented 2 years ago

I turned off my VPN and now your web app seems to be working nicely. I visited all three browser tabs and all of the information presented seems to be correct.

May I make suggestion? Your reddit post included launch instructions. This github page does not include instructions, and neither does the README file. I for one would not have known how to get started with this web app. So I think you should add instructions.

christopherjnelson commented 2 years ago

Good call. I'll update that ASAP. Appreciate it!