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

RefferenceError: results is not defined on v2.0.2 #7

Closed
evanre opened this issue Oct 23, 2019 · 14 comments
Closed

RefferenceError: results is not defined on v2.0.2 #7

evanre opened this issue Oct 23, 2019 · 14 comments

Comments

@evanre
Copy link

evanre commented Oct 23, 2019

Hi, I've just updated alfred-mdn to check if it's working after #6 fixin and got this error:

[11:38:57.374] Logging Started...
[11:39:06.348] mdn[Script Filter] Queuing argument 's'
[11:39:06.657] mdn[Script Filter] Queuing argument 'sl'
[11:39:06.857] mdn[Script Filter] Queuing argument 'sli'
[11:39:06.961] mdn[Script Filter] Queuing argument 'slic'
[11:39:07.049] mdn[Script Filter] Queuing argument 'slice'
[11:39:08.381] mdn[Script Filter] Script with argv 'slice' finished
[11:39:08.384] ERROR: mdn[Script Filter] Code 1: {
"items": [
{
"title": "ReferenceError: results is not defined\n at alfy.fetch.then.results (/Users/evanre/.nvm/versions/node/v10.13.0/lib/node_modules/alfred-mdn/index.js:9:23)\n at process._tickCallback (internal/process/next_tick.js:68:7)",
"subtitle": "Press ⌘L to see the full error and ⌘C to copy it.",
"valid": false,
"text": {
"copy": "\nReferenceError: results is not defined\n at alfy.fetch.then.results (/Users/evanre/.nvm/versions/node/v10.13.0/lib/node_modules/alfred-mdn/index.js:9:23)\n\n\n-\nmdn 2.0.2\nAlfred 4.0.3\ndarwin 18.7.0",
"largetype": "ReferenceError: results is not defined\n at alfy.fetch.then.results (/Users/evanre/.nvm/versions/node/v10.13.0/lib/node_modules/alfred-mdn/index.js:9:23)"
},
"icon": {
"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns"
}
}
]
}

@klaascuvelier
Copy link
Owner

Alright, I'll have a look at this.I can add some hardening in the results call.
Can you consistently reproduce this? Is there a specific search you did?

I currently am not able to reproduce.

@peterschussheim
Copy link

Hi Klaas I have the same problem with all searches:

ReferenceError: results is not defined
    at /Users/peter/.nvm/versions/node/v12.4.0/lib/node_modules/alfred-mdn/index.js:9:23

@klaascuvelier
Copy link
Owner

@peterschussheim @evanre how do you install the plugin?

I just did a removal + reinstall and still works for me:

➜  ~ npm uninstall -g alfred-mdn

> alfred-mdn@2.0.2 preuninstall /Users/klaas/.nvm/versions/node/v10.16.0/lib/node_modules/alfred-mdn
> alfy-cleanup

removed 225 packages in 1.66s
➜  ~ npm install -g alfred-mdn

> alfred-mdn@2.0.2 postinstall /Users/klaas/.nvm/versions/node/v10.16.0/lib/node_modules/alfred-mdn
> alfy-init

+ alfred-mdn@2.0.2
added 222 packages from 80 contributors and updated 3 packages in 11.905s

@peterschussheim
Copy link

@klaascuvelier:

I uninstalled the previous version and installed the latest exactly as you did. Did that 3 times today just to be sure.

@evanre
Copy link
Author

evanre commented Oct 23, 2019

@klaascuvelier I only typed npm install -g alfred-mdn in the terminal and 2.0.2 version has installed. The version is also changed in the WorkFlow's settings. Here is npm list output:

npm list -g --depth 0
/Users/evanre/.nvm/versions/node/v10.13.0/lib
├── alfred-mdn@2.0.2

Can you consistently reproduce this?

Yes, it repeats on any query.

@evanre
Copy link
Author

evanre commented Oct 23, 2019

Strange, but after I've tried to debug it (I just put console log in .then() callback) after few attempts it started to work. I have no idea what the problem was but it seems to me that the MDN API is buggy and can sometimes return a wrong response.

@evanre evanre closed this as completed Oct 23, 2019
@peterschussheim
Copy link

still not working on my machine

@klaascuvelier
Copy link
Owner

I'll reopen this one, as there's still people with the same issue>

@klaascuvelier klaascuvelier reopened this Oct 24, 2019
@klaascuvelier
Copy link
Owner

I just published 2.0.3 which adds a check on results so it will not throw an error, but of course this does not solve the underlying problem.

For people still experiencing issues, can you perhaps debug the transform function on the bottom of index.js file and see what's happening there?

@mesqueeb
Copy link

@klaascuvelier
2.0.3 seems to have solved the issue for me:
image

@klaascuvelier
Copy link
Owner

Weird, perhaps callback gets called multiple times? First time the results aren't available, 2nd time they are. So before with the incomplete/empty result code broke and 2nd call did not happen.
Just guessing here.
@peterschussheim @evanre does 2.0.3 work for all of you?

@peterschussheim
Copy link

@klaascuvelier 2.0.3 works. Thank you, I appreciate the time you put into fixing this promptly.

@klaascuvelier
Copy link
Owner

Published another version with the changes of the MDN endpoint.
Hope this still works for all of you.

If @evanre also has no problems anymore, then we can close this ticket :)

@evanre
Copy link
Author

evanre commented Oct 25, 2019

@klaascuvelier It works great. Thank you for your extension!

@evanre evanre closed this as completed Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants