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

VSCode commands not found: extension not loading correctly? #690

Closed
cspotcode opened this issue Nov 12, 2018 · 18 comments
Closed

VSCode commands not found: extension not loading correctly? #690

cspotcode opened this issue Nov 12, 2018 · 18 comments

Comments

@cspotcode
Copy link

In VSCode, I just upgraded to the Apollo extension version 1.1.9. Trying to invoke both contributed commands shows a VSCode "command not found" error.

image

image

How do I view logs for the extension? I'm not sure how to diagnose this issue.

@vschoettke
Copy link

The published extension is invalid. tl;dr the compiled files are missing.

I saw the following in the Developer Tools:

[Extension Host] Here is the error stack:  Error: Cannot find module '/Users/vincent/.vscode/extensions/apollographql.vscode-apollo-1.1.9/lib/extension'
	at Function.Module._resolveFilename (module.js:543:15)
	at Function.Module._load (module.js:473:25)

Looking into the corresponding extension folder I saw that there is no lib folder. Checking with the downloadable .vsix file confirmed this.

You can get a working version from the source if you build the extension yourself with the npm install && npm run package-extension (the result vscode-apollo-1.1.9.vsix file lands in the vscode-apollo folder. For whatever reason I also had to copy the node_modules/apollo-tools inside the extension to node_modules/@apollographql/apollo-tools.

@cspotcode
Copy link
Author

cspotcode commented Nov 13, 2018 via email

@trevor-scheer
Copy link
Member

Apologies! Looks like I published a bad build earlier today. This should be fixed now with 1.1.10. Thank you for submitting the issue and suggesting workarounds in the mean time 👍

@NgxDev
Copy link

NgxDev commented Jan 23, 2019

:( still having the same issue in 1.4.0
also tried 1.1.7 and 1.1.10 as suggested above, but it's all the same: command 'apollographql/reloadService' not found

@trevor-scheer
Copy link
Member

@MrCroft is this still happening for you in v1.4.5? We haven't heard any other complaints about this, nor have I been able to reproduce. If you don't mind, try deleting the downloaded version as well before reinstalling. On a mac, the extensions are stored at ~/.vscode/extensions/apollographql.vscode-apollo-x.x.x

@furier
Copy link

furier commented Feb 8, 2019

Also having issues, and I just followed @trevor-scheer advice to delete the extension folder and reinstall the extension.

image

here is my apollo.config.js file at the root of the angular project alongside package.json

module.exports = {
  client: {
    service: {
      name: 'bs-graphql',
      localSchemaFile: './schema.json',
    },
    includes: ['./src/app/**/*.gql', './src/app/**/*.graphql'],
  }
};

When I have the apollo.config.js file open in the editor and click the apollographql button on the bar at the bottom of VS Code, like this.

image

The console outputs:

🚀 Apollo GraphQL v1.4.5
------------------------------
✅ Service Loaded!
🆔 Service ID: bs-graphql
🏷 Schema Tag: current
📈 Number of Types: 535 (0 client types)

However when I do the same having any other file open than apollo.config.js

The console outputs:

🚀 Apollo GraphQL v1.4.5
------------------------------
❌ Service stats could not be loaded. This may be because you're missing an apollo.config.js file or it is misconfigured. For more information about configuring Apollo projects, see the guide here (https://bit.ly/2ByILPj).

@trevor-scheer
Copy link
Member

@furier thanks for that info!

A couple things to try:

  • Comment out the localSchemaFile line. If your schema is published to engine, you probably don't need this.
  • Double check your includes. They look good to me, but we saw the same exact issue yesterday due to a misconfigured includes key.

Is it possible for you to share this project with me to reproduce locally? Or provide a minimum reproduction?

@warmbowski
Copy link

I have the exact same problems as @furier. Same Apollo GraphQL version. One of the other oddities is that when I switch to the OUTPUT tab, in the pulldown of services, I see Apollo GraphQL listed twice. One has no output, but the other has the output like in @furier screenshot. I think the service only loads one when VSCode starts up (the one with no output), but if you click the ApolloGraphQL in the status bar, the second one appears in the list and contains the output. Not sure if that's a problem, but wanted to mention it because that seems weird.

Unlike the OP, two of the three Apollo commands work for me (only Apollo:Show Status fails).

I also wanted to mention that there is another issue that mentions that folks can get Apollo GraphQL to work with Engine, but not with remote or local schema (#902 ), and so I wanted to mention that here in case theres some connection.

@warmbowski
Copy link

@furier, I got it working. It was a problem in the includes config. I made the change from includes: ['./examples/**/*.{ts,tsx}'], to includes: ['examples/**/*.{ts,tsx}'], and my syntax highlighting and auto-complete started working. And I no longer got the "❌ Service stats could not be loaded. . ." error message when in my component files. So it seems that the includes globs cannot start with ./. This seems like a bug to me, since I would expect to be able to use either syntax (I prefer ./).

@warmbowski
Copy link

I'm pretty sure that the problem lies in the line of code linked below, and it's based on the way path.relative() works. So there will be no match with globs that start with ./ in the apollo-language-server.

https://github.com/apollographql/apollo-tooling/blob/master/packages/apollo-language-server/src/fileSet.ts#L31

@warmbowski
Copy link

warmbowski commented Feb 9, 2019

Or it could be the way minimatch() treats ./relative/**/*.{ts,tsx} and relative/**/*.{ts,tsx}differently, when they are essentially the same. I can't decide and would love to hear some other folks' input.

@trevor-scheer
Copy link
Member

@warmbowski thanks for looking around, this is great information. Would you mind opening a new issue for this specifically? We'd love a PR that fixes this if anyone is interested in solving the issue 😄

@furier
Copy link

furier commented Feb 11, 2019

@trevor-scheer thanks it works now with the path changes. :)

@Relaxe111
Copy link

I have same issue with v1.6.4 also it was with v.1.5.2 it works with v 1.5.0
here is my appolo.config.js:

module.exports = {
    client: {
        service: { 
          name: 'localhost',
          url: "http://localhost:5000/graphql", 
    
        },
        skipSSLValidation: true,
        excludes: ['node_modules/**/*'],
        includes: ["src/**/*.{ts,gql,tsx,js,jsx,graphql}"],
      },
    };

for v 1.6.4:

🚀 Apollo GraphQL v1.6.4
------------------------------
❌ Service stats could not be loaded. This may be because you're missing an apollo.config.js file or it is misconfigured. For more information about configuring Apollo projects, see the guide here (https://bit.ly/2ByILPj).

for v 1.5.0:

------------------------------
🚀 Apollo GraphQL v1.5.0
------------------------------
✅ Service Loaded!
🆔 Service ID: localhost
🏷 Schema Tag: current
📈 Number of Types: 223 (0 client types)
------------------------------

@peterholak
Copy link

peterholak commented Aug 28, 2019

Had this happen on Windows recently with the latest version. Uninstalling the extension, restarting VS Code, and reinstalling fixed the problem.

@SpaghettiC0des
Copy link

Had this happen on Windows recently with the latest version. Uninstalling the extension, restarting VS Code, and reinstalling fixed the problem.

This resolves the issue for me, after an hour of frustration. Thanks, man!

@cglacet
Copy link

cglacet commented Oct 12, 2021

I still have the issue, re-installing does temporarily solve the issue, but after a while it crashes again. (version v1.19.6)

In case that matters, it's a test server running locally, and I can still ping the server for its schema manually so it's not a server problem.

Restarting vscode also seems to work.

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

10 participants