os-js / osjs-xterm-application

OS.js Xterm Application

Home Page:https://manual.os-js.org/v3/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

404 error when included in OS.js

ajmeese7 opened this issue · comments

Hey there, I am getting the following error when I add "@osjs/xterm-application": "^1.4.0" to my package.json:

http://localhost:8000/apps/Xterm/create 404 (Not Found)

Do you have any ideas why, or how I would go about fixing this?

Any errors in your logs when you start the server ?

Also, if you didn't restart the server, you'd probably have to do that to get the server-side scripts to load.

No errors when I start the server, and I did restart the server. This is all that is logged to the client:

xterm errors

Tried to reproduce this on a fresh instance:

git clone -b master --single-branch https://github.com/os-js/OS.js.git
cd OS.js
npm install
npm run build
npm install @osjs/xterm-application
npm run package:discover
npm run serve

I saw the following in my server log:

ℹ Loading /node_modules/@osjs/xterm-application/server.js

And after loading the app I got:

[Xterm] Requested connection...
POST /apps/Xterm/create 200 47 - 1.133 ms
[Xterm] Creating connection...
WebSocket connection opened                                                                                                                                                                                                      
GET /apps/Xterm/logo.svg 200 337 - 1.692 ms
[Xterm] Creating terminal... {
  useLogin: true,
  options: {
    options: { connection: {}, size: [Object] },
    username: 'demo',
    uuid: '1a48e8da-105c-4bad-939a-7436604f734a'
  },
  args: [ '-c', 'ssh  demo@localhost' ]
}
[Xterm] Requested resize...
POST /apps/Xterm/resize 200 - - 0.732 ms
WebSocket connection closed                                                                                                                                                                                                     

Did you get the "loading" message in your logs ?

I did not have that logged on the server

The only two things that really comes to mind is:

  1. The application was not installed correctly. Did you encounter any errors while/after installing it ?
  2. The server was not restarted after running the discover command

No errors during or after install, and the server was restarted after running the discover command. I'll do some more deep digging and see if I can figure out what's going on

Unless there's some conflict with a local package you have in src/packages or something like that, nothing more comes to mind at the moment.

The [generated] file packages.json in your root contains the list of packages that the server will use to locate the server scripts (defined in the metadata file of a package), which in turn is loaded and gives that log loading message.

I just deleted my entire project and recloned it and the issue disappeared, I'm not sure what went wrong. I'm going to close this issue out but I'll come back and leave a comment if I find a reason, so anyone else who has this issue can refer to it.

Thanks for your time!

but I'll come back and leave a comment if I find a reason

That would be great! :)

My immediate thought goes towards the commits you made here (which changed some of the naming etc): #22

At least if those changes were made inside the installed package in your project then that def could explain it.

That is what I am thinking of well, I am trying to transition my modification of OS.js to a Rush monorepo for the first time. Chances are I probably made a small change somewhere that I'm overlooking, I'm redoing everything step by step to see if I can determine what went wrong and how to fix it

The issue was that somewhere along the line I updated some dependencies in @osjs/server and it broke the backend. Restoring the package.json to the original ended up fixing the problem. Thanks again!

For posterity: the issue arose from updating the fast-glob package to 3.x. For fixes, see this changelog in how to update the usage of the dependency in packages.js!