JetBrains / js-graphql-intellij-plugin

GraphQL language support for WebStorm, IntelliJ IDEA and other IDEs based on the IntelliJ Platform.
https://jimkyndemeyer.github.io/js-graphql-intellij-plugin/
MIT License
879 stars 97 forks source link

Introspection is broken since V4 update, and all previously generated schema is no more recognisable by Graphql plugin #685

Closed just-be-weird closed 10 months ago

just-be-weird commented 10 months ago

Before you create the issue

Describe the bug A clear and concise description of what the bug is.

To Reproduce Link to Repo with Reproduction or Steps to Reproduce:

  1. Go to graphql.config.yml
    
    projects:
    admin:
    schema: /src/graphql/generated/admin-schema.graphql
    include: /src/graphql/generated/admin-schema.graphql
    extensions:
      endpoints:
        graphql-admin:
          headers:
            user-agent: JS GraphQL
          introspect: true
          url: http://localhost:3000/graphql-admin
    buyer:
    schema: /src/graphql/generated/buyer-schema.graphql
    include: /src/graphql/generated/buyer-schema.graphql
    extensions:
      endpoints:
        graphql-buyer:
          url: http://localhost:3000/graphql
          headers:
            user-agent: JS GraphQL
          introspect: true
    supplier:
    schema: /src/graphql/generated/supplier-schema.graphql
    include: /src/graphql/generated/supplier-schema.graphql
    extensions:
      endpoints:
        graphql-supplier:
          url: http://localhost:3000/graphql-supplier
          headers:
            user-agent: JS GraphQL
          introspect: true
3. Click on run button to execute the introspection
5. See error
```log
java.io.IOException: unable to create target directory: path=/src/graphql/generated/admin-schema.graphql
    at com.intellij.lang.jsgraphql.ide.introspection.GraphQLIntrospectionService$IntrospectionQueryTask.lambda$run$0(GraphQLIntrospectionService.java:638)
    at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:208)
    at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:21)
    at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:190)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:861)
    at com.intellij.openapi.application.impl.ApplicationImpl$4.run(ApplicationImpl.java:478)
    at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:79)
    at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:121)
    at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:41)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:789)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:740)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:734)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:759)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:685)
    at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$10(IdeEventQueue.kt:589)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWithoutImplicitRead(ApplicationImpl.java:1485)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:589)
    at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:67)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:369)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:368)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:368)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:363)
    at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:992)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
    at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:992)
    at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:363)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:861)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:405)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

Expected behavior

Screenshots image

image

Version and Environment Details Operation system: Mac 13.4.1 (c) (22F770820d) (M2 - 2022)

IDE name and version

WebStorm 2023.2
Build #WS-232.8660.143, built on July 21, 2023
Runtime version: 17.0.7+7-b1000.6 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 13.4.1
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 8
Metal Rendering is ON
Registry:
    ide.intellij.laf.enable.animation=true
    debugger.new.tool.window.layout=true
    ide.experimental.ui=true
    ide.balloon.shadow.size=0

Non-Bundled Plugins:
    com.markskelton.one-dark-theme (5.8.0)
    Key Promoter X (2023.2.0)
    com.wakatime.intellij.plugin (14.1.5)
    ru.adelf.idea.dotenv (2023.2)
    IdeaVIM (2.4.1)
    com.stepsize.tech-debt-reporter (1.53.13-211+)
    com.mallowigi (92.0.0)
    com.intellij.lang.jsgraphql (4.0.2)
    mdx.js (232.8660.129)
    izhangzhihao.rainbow.brackets (2023.3.2)

Plugin version: 4.02

Additional context

As a workaround, I restored to an earlier version of this plugin, but since the upgrade to WS-232.8660.143, that version can no longer be installed from source. I've attached a functioning version of the plugin in the hopes that it will be of some assistance. I hope this gets addressed soon because we rely greatly on it and it is tough to work without it, thanks.

js-graphql-intellij-plugin-3.4.0.zip

vepanimas commented 10 months ago

@just-be-weird Could you please try changing /src/graphql/generated/admin-schema.graphql to ./src/graphql/generated/admin-schema.graphql?

just-be-weird commented 10 months ago

@just-be-weird Could you please try changing /src/graphql/generated/admin-schema.graphql to ./src/graphql/generated/admin-schema.graphql?

Yes, I did try this and it worked. However, the plugin is still unable to recognise the schema types. Any idea what could be wrong here?

image

vepanimas commented 10 months ago

Also, you can try to remove include completely, specifying schema is enough now to include type definitions into the scope.

Regarding the errors on your screenshot, it's not enough information to say what's going wrong. Are there any other errors of a different kind in the schema file?

just-be-weird commented 10 months ago

Also, you can try to remove include completely, specifying schema is enough now to include type definitions into the scope.

Regarding the errors on your screenshot, it's not enough information to say what's going wrong. Are there any other errors of a different kind in the schema file?

No this is the only issue left rest else seems to be working fine. What other info you would need that would help you in debugging this issue?

just-be-weird commented 10 months ago

@vepanimas we can mark this as resolved and close the issue. In order to get schema discovery working, I had to slightly modify the graphql configuration. I made the following changes in case anyone else runs into the same discovery problem

---      include: /src/graphql/generated/admin-schema.graphql
+++    documents: src/graphql/generated/admin-schema.graphql
vepanimas commented 10 months ago

@just-be-weird hi! Sorry for the late response.

What other info you would need that would help you in debugging this issue? It's very hard to debug this without having full schema sources and a detailed description of the project structure, unfortunately.

This is really weird that it helped. What's changed here is that type definitions from src/graphql/generated/admin-schema.graphql won't be included in the schema anymore, only queries, mutations, and subscriptions.

---      include: /src/graphql/generated/admin-schema.graphql
+++    documents: src/graphql/generated/admin-schema.graphql