sveale / remote-edit

remote-edit
MIT License
146 stars 54 forks source link

Uncaught TypeError: Cannot read property 'alias' of undefined #169

Open Jstaud opened 8 years ago

Jstaud commented 8 years ago

[Enter steps to reproduce below:]

  1. update to latest version
  2. try to add new host sftp

Atom Version: 1.5.3 System: Mac OS X 10.11.3 Thrown From: remote-edit package, v1.8.24

Stack Trace

Uncaught TypeError: Cannot read property 'alias' of undefined

At /Users/<USERNAME>/.atom/packages/remote-edit/lib/model/host.coffee:34

TypeError: Cannot read property 'alias' of undefined
    at SftpHost.module.exports.Host.getSearchKey (/Users/<USERNAME>/.atom/packages/remote-edit/lib/model/host.coffee:34:63)
    at /Users/<USERNAME>/.atom/packages/remote-edit/lib/model/host.coffee:18:9
    at Config.module.exports.Config.observeKeyPath (/Applications/Atom.app/Contents/Resources/app.asar/src/config.js:612:7)
    at Config.module.exports.Config.observe (/Applications/Atom.app/Contents/Resources/app.asar/src/config.js:141:21)
    at SftpHost.Host (/Users/<USERNAME>/.atom/packages/remote-edit/lib/model/host.coffee:17:19)
    at new SftpHost (/Users/<USERNAME>/.atom/packages/remote-edit/lib/model/sftp-host.coffee:32:7)
    at Object.module.exports.newHostSftp (/Users/<USERNAME>/.atom/packages/remote-edit/lib/main.coffee:93:70)
    at atom-workspace.<anonymous> (/Users/<USERNAME>/.atom/packages/remote-edit/lib/main.coffee:83:17)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:260:29)
    at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:3:61)
    at CommandRegistry.module.exports.CommandRegistry.dispatch (/Applications/Atom.app/Contents/Resources/app.asar/src/command-registry.js:160:19)
    at AtomEnvironment.module.exports.AtomEnvironment.dispatchApplicationMenuCommand (/Applications/Atom.app/Contents/Resources/app.asar/src/atom-environment.js:1013:28)
    at emitOne (events.js:77:13)
    at EventEmitter.emit (events.js:169:7)

Commands

     -0:11.5.0 remote-edit:browse (atom-workspace.workspace.scrollbars-visible-when-scrolling.theme-atom-material-syntax.theme-atom-material-ui)
  3x -0:08.1.0 core:backspace (atom-text-editor.editor.mini.is-focused)
     -0:00.7.0 remote-edit:new-host-sftp (atom-text-editor.editor.mini.is-focused)

Config

{
  "core": {
    "themes": [
      "atom-material-ui",
      "atom-material-syntax"
    ]
  }
}

Installed Packages

# User
angularjs, v0.3.3
atom-material-syntax, v0.2.4
atom-material-ui, v0.6.1
autocomplete-angular-material, v0.4.0
autocomplete-ionic-framework, v0.2.1
color-picker, v2.0.13
css-color-underline, v1.0.1
file-icons, v1.6.13
remote-edit, v1.8.24

# Dev
No dev packages
josherickson commented 8 years ago

I'm seeing the same or similar error, but getting to it a different way.

Steps to reproduce:

  1. Open a remote file via remote-edit.
  2. Close Atom.
  3. Open Atom. (Throws error)
  4. Close Atom.
  5. Open Atom. (Works fine)

Atom version: 1.5.4 System: Windows 8.1 remote-edit version: 1.8.24

Stack Trace

TypeError: Cannot read property 'alias' of undefined
at SftpHost.module.exports.Host.getSearchKey (file:///C:/Users/Josh/.atom/packages/remote-edit/lib/model/host.coffee:34:63)
at file:///C:/Users/Josh/.atom/packages/remote-edit/lib/model/host.coffee:18:9
at Config.module.exports.Config.observeKeyPath (C:\Users\Josh\AppData\Local\atom\app-1.5.4\resources\app.asar\src\config.js:612:7)
at Config.module.exports.Config.observe (C:\Users\Josh\AppData\Local\atom\app-1.5.4\resources\app.asar\src\config.js:141:21)
at SftpHost.Host (file:///C:/Users/Josh/.atom/packages/remote-edit/lib/model/host.coffee:17:19)
at new SftpHost (file:///C:/Users/Josh/.atom/packages/remote-edit/lib/model/sftp-host.coffee:32:7)
at Function.module.exports.Serializable.deserialize (C:\Users\Josh\AppData\Local\atom\app-1.5.4\resources\app.asar\node_modules\text-buffer\node_modules\serializable\lib\serializable.js:70:27)
at Function.module.exports.RemoteEditEditor.deserialize (file:///C:/Users/Josh/.atom/packages/remote-edit/lib/model/remote-edit-editor.coffee:156:27)
at DeserializerManager.module.exports.DeserializerManager.deserialize (C:\Users\Josh\AppData\Local\atom\app-1.5.4\resources\app.asar\src\deserializer-manager.js:45:29)
at C:\Users\Josh\AppData\Local\atom\app-1.5.4\resources\app.asar\src\pane.js:34:30
at Array.map (native)
at Function.module.exports.Pane.deserialize (C:\Users\Josh\AppData\Local\atom\app-1.5.4\resources\app.asar\src\pane.js:33:35)
at DeserializerManager.module.exports.DeserializerManager.deserialize (C:\Users\Josh\AppData\Local\atom\app-1.5.4\resources\app.asar\src\deserializer-manager.js:45:29)
at PaneContainer.module.exports.PaneContainer.deserialize (C:\Users\Josh\AppData\Local\atom\app-1.5.4\resources\app.asar\src\pane-container.js:64:40)
at Workspace.module.exports.Workspace.deserialize (C:\Users\Josh\AppData\Local\atom\app-1.5.4\resources\app.asar\src\workspace.js:155:33)
at AtomEnvironment.module.exports.AtomEnvironment.loadStateSync (C:\Users\Josh\AppData\Local\atom\app-1.5.4\resources\app.asar\src\atom-environment.js:940:24)
at AtomEnvironment.module.exports.AtomEnvironment.startEditorWindow (C:\Users\Josh\AppData\Local\atom\app-1.5.4\resources\app.asar\src\atom-environment.js:685:12)
at module.exports (C:\Users\Josh\AppData\Local\atom\app-1.5.4\resources\app.asar\src\initialize-application-window.js:28:10)
at setupWindow (file:///C:/Users/Josh/AppData/Local/atom/app-1.5.4/resources/app.asar/static/index.js:86:5)
at window.onload (file:///C:/Users/Josh/AppData/Local/atom/app-1.5.4/resources/app.asar/static/index.js:41:9)handleSetupError @ index.js:62
stemd commented 8 years ago

I'm confirming bug, same (buggy) behavior, different environment:

Steps to reproduce:

  1. Open a remote file via remote-edit.
  2. Close Atom.
  3. Open Atom. (Throws error)
  4. Close Atom.
  5. Open Atom. (Works fine)

Atom version: 1.5.4 System: Linux remote-edit version: 1.8.24

Stack trace omitted as not needed (same as above, just replace file:///C:/Users/Josh/ with /home/user).

stemd commented 8 years ago

Just updated to new version of Atom: Atom version: 1.6.0

Error still present. Just to let you know, recent Atom changes broke also some other packages, which give almost the same error (TypeError: Cannot read property 'something' of undefined).

Backwards compatibility is hard to achieve.

Romz commented 8 years ago

Same here

d4n1elchen commented 8 years ago

Same

[Enter steps to reproduce below:]

  1. Open Atom
  2. Try to add new host

Atom Version: 1.6.0 System: Unknown Windows Version Thrown From: remote-edit package, v1.8.24

Stack Trace

Uncaught TypeError: Cannot read property 'alias' of undefined

At /C:/Users/User/.atom/packages/remote-edit/lib/model/host.coffee:62

TypeError: Cannot read property 'alias' of undefined
    at SftpHost.module.exports.Host.getSearchKey (file:///C:/Users/User/.atom/packages/remote-edit/lib/model/host.coffee:34:63)
    at file:///C:/Users/User/.atom/packages/remote-edit/lib/model/host.coffee:18:9
    at Config.module.exports.Config.observeKeyPath (C:\Users\User\AppData\Local\atom\app-1.6.0\resources\app.asar\src\config.js:612:7)
    at Config.module.exports.Config.observe (C:\Users\User\AppData\Local\atom\app-1.6.0\resources\app.asar\src\config.js:141:21)
    at SftpHost.Host (file:///C:/Users/User/.atom/packages/remote-edit/lib/model/host.coffee:17:19)
    at new SftpHost (file:///C:/Users/User/.atom/packages/remote-edit/lib/model/sftp-host.coffee:32:7)
    at Object.module.exports.newHostSftp (file:///C:/Users/User/.atom/packages/remote-edit/lib/main.coffee:93:70)
    at atom-workspace.<anonymous> (file:///C:/Users/User/.atom/packages/remote-edit/lib/main.coffee:83:17)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (C:\Users\User\AppData\Local\atom\app-1.6.0\resources\app.asar\src\command-registry.js:260:29)
    at CommandRegistry.handleCommandEvent (C:\Users\User\AppData\Local\atom\app-1.6.0\resources\app.asar\src\command-registry.js:3:61)
    at CommandRegistry.module.exports.CommandRegistry.dispatch (C:\Users\User\AppData\Local\atom\app-1.6.0\resources\app.asar\src\command-registry.js:160:19)
    at AtomEnvironment.module.exports.AtomEnvironment.dispatchApplicationMenuCommand (C:\Users\User\AppData\Local\atom\app-1.6.0\resources\app.asar\src\atom-environment.js:1013:28)
    at emitOne (events.js:77:13)
    at EventEmitter.emit (events.js:169:7)

Commands

     -6:57.2.0 remote-edit:new-host-sftp (atom-text-editor.editor.is-focused)
     -6:48.2.0 about:view-release-notes (atom-workspace.workspace.scrollbars-visible-always.theme-one-dark-syntax.theme-one-dark-ui)
     -6:37.1.0 release-notes:show (atom-text-editor.editor.is-focused)
     -4:09.7.0 remote-edit:browse (div.panels-item)
     -4:03.2.0 remote-edit:new-host-sftp (atom-text-editor.editor.mini.is-focused)
     -3:19.9.0 remote-edit:show-open-files (atom-workspace.workspace.scrollbars-visible-always.theme-one-dark-syntax.theme-one-dark-ui)
     -3:18.1.0 core:confirm (atom-text-editor.editor.mini.is-focused)
     -2:25 remote-edit:show-open-files (input#remote-edit.showHiddenFiles.)
     -2:20 core:backspace (atom-text-editor.editor.mini.is-focused)
     -2:10.8.0 core:confirm (atom-text-editor.editor.mini.is-focused)
     -1:56.8.0 remote-edit:new-host-sftp (atom-workspace.workspace.scrollbars-visible-always.theme-one-dark-syntax.theme-one-dark-ui)

Config

{
  "core": {
    "disabledPackages": [
      "preview-plus",
      "angularjs"
    ]
  },
  "remote-edit": {
    "showHiddenFiles": true
  }
}

Installed Packages

# User
angularjs, v0.3.4
atom-html-preview, v0.1.19
atom-jade, v0.3.0
autocomplete-sass, v0.1.0
coffee-compile, v0.21.1
color-picker, v2.1.1
emmet, v2.4.3
language-matlab, v0.2.1
open-recent, v5.0.0
release-notes, v0.53.0
remote-edit, v1.8.24
sass-autocompile, v0.12.6
save-session, v0.16.0
sync-settings, v0.7.2

# Dev
No dev packages
stemd commented 8 years ago

In Atom 1.7.2 if you leave open remote file on closing Atom, on next open you'll see only main menu of Atom window and everything inside it is black. If you try opening local file window will stay black. Your only solution is to close Atom and reopen it, Alt+Ctrl+R is doing nothing, you can do "Open in dev mode" (View->Developer->Open in dev mode), from where you can see that problem is still the same: "Cannot read property 'alias' of undefined".

Workaround exist, close all remote windows before closing Atom, but that can be quite inconvenient when working on lot of remote files. This bug SHOULD be addressed, as it persists from Atom 1.5.3 onward to at this moment Atom 1.7.2, and now behavior is even worse than before.

stemd commented 8 years ago

My CoffeeScript debugging skills suck, but I got following:

  1. Cannot read property 'alias' of undefined is referencing following line (in file host.coffee): toReturn = "#{toReturn} #{@alias}" if searchKeySettings["alias"] which means that searchKeySettings object (probably hashtable) is undefined.
  2. This object is initialized with this line: atom.config.observe "remote-edit.filterHostsUsing", (settings) => @searchKey = @getSearchKey(settings) ? @searchKey

In JS notation: atom.config.observe("remote-edit.filterHostsUsing", (function(_this) { return function(settings) { var ref; return _this.searchKey = (ref = _this.getSearchKey(settings)) != null ? ref : _this.searchKey; };

  1. Either atom.config.observe is broken or called to early or something similar.
stemd commented 8 years ago

Workaround: I changed in file .atom/packages/remote-edit/lib/model/host.coffee in line 17 method atom.config.observe for atom.config.get and now atom is opening fine, after you closed it with open remote files.

As observe method is meant to load new settings when they occur, this change means that for any changes in existing remote-edit settings you probably need to reload atom window (or close-open atom), but I can live with it. :)