Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update fails if a plugin is not bower registered #180

Closed
chris-steele opened this issue Dec 5, 2022 · 6 comments · Fixed by #204
Closed

update fails if a plugin is not bower registered #180

chris-steele opened this issue Dec 5, 2022 · 6 comments · Fixed by #204
Assignees

Comments

@chris-steele
Copy link
Contributor

chris-steele commented Dec 5, 2022

Subject of the issue/enhancement/features

Running adapt update may produce a runtime error if there are plugins not registered with bower registry being used.

The cause seems to be trying to read _sourceInfo in getMatchingVersion (Plugin.js). The property is null if trying to retrieve bower info from a registry that does not have the requested plugin registered.

Your environment

  • 3.0.7
  • Windows 10

Steps to reproduce

See description

Expected behaviour

The update command should skip unregistered plugins

Actual behaviour

 Cannot read properties of null (reading 'framework')
    at getMatchingVersion (file:///C:/Users/Chris/AppData/Roaming/nvm/v16.18.1/node_modules/adapt-cli/lib/integration/Plugin.js:296:79)
    at Target.findCompatibleVersion (file:///C:/Users/Chris/AppData/Roaming/nvm/v16.18.1/node_modules/adapt-cli/lib/integration/Plugin.js:321:33)
    at file:///C:/Users/Chris/AppData/Roaming/nvm/v16.18.1/node_modules/adapt-cli/lib/integration/PluginManagement/update.js:115:22
    at file:///C:/Users/Chris/AppData/Roaming/nvm/v16.18.1/node_modules/adapt-cli/lib/util/promises.js:16:12
    at C:\Users\Chris\AppData\Roaming\nvm\v16.18.1\node_modules\adapt-cli\node_modules\async\dist\async.js:151:38
    at replenish (C:\Users\Chris\AppData\Roaming\nvm\v16.18.1\node_modules\adapt-cli\node_modules\async\dist\async.js:446:21)
    at C:\Users\Chris\AppData\Roaming\nvm\v16.18.1\node_modules\adapt-cli\node_modules\async\dist\async.js:451:13
    at eachOfLimit$1 (C:\Users\Chris\AppData\Roaming\nvm\v16.18.1\node_modules\adapt-cli\node_modules\async\dist\async.js:477:34)
    at C:\Users\Chris\AppData\Roaming\nvm\v16.18.1\node_modules\adapt-cli\node_modules\async\dist\async.js:219:25
@chris-steele chris-steele changed the title update failes if a plugin is not bower registered update fails if a plugin is not bower registered Dec 5, 2022
@oliverfoster oliverfoster self-assigned this Feb 14, 2023
@oliverfoster oliverfoster moved this from New to Assigned in adapt_framework: The TODO Board Feb 14, 2023
@swashbuck
Copy link
Contributor

It looks like there is a similar error when running adapt ls.

@swashbuck
Copy link
Contributor

if (!this.isPresent) return null

@oliverfoster What about changing this line to:

if (!this.isPresent || !this._sourceInfo?.version || !this._sourceInfo?.framework) return null;

This seems to resolve the issue.

@oliverfoster
Copy link
Member

I can't replicate on version 3.1.4 in either case, for adapt update and adapt ls.
I've tested with a local plugin and with a non existent plugin in the adapt.json file.

Please reopen if you have replication instructions.

@github-project-automation github-project-automation bot moved this from Assigned to Recently Released in adapt_framework: The TODO Board May 14, 2024
@swashbuck
Copy link
Contributor

@oliverfoster I am also using 3.1.4. Will you try this?

  1. In your extensions directory, git clone git@github.com:cgkineo/adapt-toc.git
  2. Optionally, add it to your adapt.json with "adapt-toc": "*". I get the error either way.
  3. Run adapt update --check

Result:

TypeError: Cannot read properties of null (reading 'framework')
    at getMatchingVersion (file:///Users/bradsimpson/.nvm/versions/node/v20.11.1/lib/node_modules/adapt-cli/lib/integration/Plugin.js:298:79)
    at Target.findCompatibleVersion (file:///Users/bradsimpson/.nvm/versions/node/v20.11.1/lib/node_modules/adapt-cli/lib/integration/Plugin.js:323:33)
    at file:///Users/bradsimpson/.nvm/versions/node/v20.11.1/lib/node_modules/adapt-cli/lib/integration/PluginManagement/update.js:115:22
    at file:///Users/bradsimpson/.nvm/versions/node/v20.11.1/lib/node_modules/adapt-cli/lib/util/promises.js:16:12
    at /Users/bradsimpson/.nvm/versions/node/v20.11.1/lib/node_modules/adapt-cli/node_modules/async/dist/async.js:151:38
    at replenish (/Users/bradsimpson/.nvm/versions/node/v20.11.1/lib/node_modules/adapt-cli/node_modules/async/dist/async.js:448:21)
    at iterateeCallback (/Users/bradsimpson/.nvm/versions/node/v20.11.1/lib/node_modules/adapt-cli/node_modules/async/dist/async.js:432:21)
    at /Users/bradsimpson/.nvm/versions/node/v20.11.1/lib/node_modules/adapt-cli/node_modules/async/dist/async.js:329:20
    at invokeCallback (/Users/bradsimpson/.nvm/versions/node/v20.11.1/lib/node_modules/adapt-cli/node_modules/async/dist/async.js:182:13)
    at /Users/bradsimpson/.nvm/versions/node/v20.11.1/lib/node_modules/adapt-cli/node_modules/async/dist/async.js:174:13

@oliverfoster
Copy link
Member

That helped. Thanks.

@joe-allen-89 joe-allen-89 moved this from Assigned to Needs Reviewing in adapt_framework: The TODO Board May 20, 2024
@github-project-automation github-project-automation bot moved this from Needs Reviewing to Recently Released in adapt_framework: The TODO Board Jun 11, 2024
Copy link

🎉 This issue has been resolved in version 3.1.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants