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

GraphQL Modules issue with deps #2243

Open
tvvignesh opened this issue Aug 30, 2022 · 3 comments
Open

GraphQL Modules issue with deps #2243

tvvignesh opened this issue Aug 30, 2022 · 3 comments

Comments

@tvvignesh
Copy link
Contributor

tvvignesh commented Aug 30, 2022

Describe the bug

Hi. I deleted by yarn.lock file and node_modules just to reinstall all dependencies afresh and I was able to do that but an issue occurred with GraphQL Modules. I started getting this error below (I am using Dependency Injection)

image

And there is no change in the code or the environment when it was working and when it was not working - the only changes are in yarn.lock and thus the dependencies themselves (when I roll back to the old yarn.lock everything works). Can you help on why it breaks on upgrade?

To Reproduce
Steps to reproduce the behavior:

**Working yarn.lock file: ** https://gist.github.com/tvvignesh/cc043ae59c18fd3920fdeb9bb8b615a0#file-yarn-working-lock

**yarn.lock file with issue: ** https://gist.github.com/tvvignesh/cc043ae59c18fd3920fdeb9bb8b615a0#file-yarn-notworking-lock

Expected behavior

Expecting GraphQL modules to work even on dependency upgrades

Environment:

  • OS: Ubuntu 22.04

**PS: ** I use yarn 2 for install

@tvvignesh
Copy link
Contributor Author

@kamilkisiela @ardatan Any hints?

@tvvignesh
Copy link
Contributor Author

@n1ru4l @kamilkisiela @ardatan GraphQL Modules Dependency Injection with @envelop/graphql-modules or one of the dependencies from my yarn lock has crazy bug in this release - for instance, the injector loads a different provider when you try to load a different provider and this varies based on the sequence of modules in createApplication. Rolling back to previous version

@tvvignesh
Copy link
Contributor Author

For instance, if I log context.injector.get(Member) and I just change the sequence of modules in the application, this is how the log changes

THIS WORKS

Member {
    context: {
        request: Request {
        size: 0,
        timeout: 0,
        follow: 20,
        compress: true,
        counter: 0,
        agent: undefined,
        formData: [Function: formData],
        [Symbol(Body internals)]: [Object],
        [Symbol(Request internals)]: [Object]
        },
        operationName: 'listMembers',
        query: 'query listMembers {\n' +
        '\tmembers {\n' +
        '\t\tkey\n' +
        '\t\tusername\n' +
        '\t\tname\n' +
        '\t\temail\n' +
        '\t\tphone\n' +
        '\t\tpictureUrl\n' +
        '\t\tcreatedDate\n' +
        '\t}\n' +
        '}\n',
        variables: undefined,
        extensions: undefined,
        req: _Request {
        id: 'req-5',
        context: [Context],
        params: {},
        raw: [IncomingMessage],
        query: {},
        log: [EventEmitter],
        body: [Object],
        corsPreflightEnabled: false,
        tmpUploads: null,
        [Symbol(fastify.RequestPayloadStream)]: [IncomingMessage]
        },
        reply: _Reply {
        raw: [ServerResponse],
        request: [_Request],
        log: [EventEmitter],
        [Symbol(fastify.reply.isError)]: false,
        [Symbol(fastify.reply.errorHandlerCalled)]: false,
        [Symbol(fastify.reply.hijacked)]: false,
        [Symbol(fastify.reply.serializer)]: null,
        [Symbol(fastify.reply.headers)]: [Object],
        [Symbol(fastify.reply.trailers)]: null,
        [Symbol(fastify.reply.startTime)]: 5102031.987665,
        [Symbol(fastify.reply.endTime)]: undefined
        },
        user: {
        _key: '36a0e51f-7a27-4aa9-9810-3cfe1552eef3',
        name: 'Vignesh T.V',
        username: 'vignesh',
        email: '[email protected]'
        },
        tenant: {
        activeWorkspaceKey: '9c2456b7-1041-4314-97ec-0dd944304e00',
        tenantURI: 'tenant-1'
        },
        workspace: WorkspaceDB {
        url: 'http://core-tenant-arangodb:8529',
        workspaceURI: 'test-wspace3',
        dbname: 'tcnKyzgHSYogsZXT0',
        dbusername: 'fRqRNNrpdda0wLp',
        dbpassword: 'h4kvLzfnvahDGxU',
        db: [Database],
        entity: [Entity],
        graph: [TCGraph]
        },
        'ɵgetModuleContext': [Function: getModuleContext],
        injector: ReflectiveInjector {
        _constructionCounter: 2,
        _executionContextGetter: [Function: notInExecutionContext],
        displayName: 'Module "member" (Operation Scope)',
        _parent: [ReflectiveInjector],
        _fallbackParent: [ReflectiveInjector],
        _providers: [Array],
        _globalProvidersMap: Map(0) {},
        _keyIds: [Array],
        _objs: [Array]
        },
        moduleId: 'member',
        [Symbol(promPluginExecutionStartTimeSymbol)]: 1662101684678,
        [Symbol(rawDocument)]: 'query listMembers {\n' +
        '\tmembers {\n' +
        '\t\tkey\n' +
        '\t\tusername\n' +
        '\t\tname\n' +
        '\t\temail\n' +
        '\t\tphone\n' +
        '\t\tpictureUrl\n' +
        '\t\tcreatedDate\n' +
        '\t}\n' +
        '}\n',
        [Symbol(promPluginContext)]: {
        document: [Object],
        operationName: 'listMembers',
        operationType: 'query'
        },
        [Symbol(GRAPHQL_MODULES)]: {
        context: [Object],
        injector: [ReflectiveInjector],
        destroy: [Function (anonymous)],
        'ɵdestroy': [Function (anonymous)]
        },
        [Symbol(RESOLVERS_HOOKS)]: [ [Function (anonymous)] ]
    },
    data: Data {
        context: {
        request: [Request],
        operationName: 'listMembers',
        query: 'query listMembers {\n' +
            '\tmembers {\n' +
            '\t\tkey\n' +
            '\t\tusername\n' +
            '\t\tname\n' +
            '\t\temail\n' +
            '\t\tphone\n' +
            '\t\tpictureUrl\n' +
            '\t\tcreatedDate\n' +
            '\t}\n' +
            '}\n',
        variables: undefined,
        extensions: undefined,
        req: [_Request],
        reply: [_Reply],
        user: [Object],
        tenant: [Object],
        workspace: [WorkspaceDB],
        'ɵgetModuleContext': [Function: getModuleContext],
        injector: [ReflectiveInjector],
        moduleId: 'member',
        [Symbol(promPluginExecutionStartTimeSymbol)]: 1662101684678,
        [Symbol(rawDocument)]: 'query listMembers {\n' +
            '\tmembers {\n' +
            '\t\tkey\n' +
            '\t\tusername\n' +
            '\t\tname\n' +
            '\t\temail\n' +
            '\t\tphone\n' +
            '\t\tpictureUrl\n' +
            '\t\tcreatedDate\n' +
            '\t}\n' +
            '}\n',
        [Symbol(promPluginContext)]: [Object],
        [Symbol(GRAPHQL_MODULES)]: [Object],
        [Symbol(RESOLVERS_HOOKS)]: [Array]
        },
        db: Database {
        _analyzers: Map(0) {},
        _collections: [Map],
        _graphs: [Map],
        _views: Map(0) {},
        _connection: [Connection],
        _name: 'tcnKyzgHSYogsZXT0'
        }
    }
    }

THIS DOES NOT WORK

Looks like its loading a different provider (Workspace) when I ask for member just when changing the sequence within application

Workspace {
   context: {
     request: Request {
       size: 0,
       timeout: 0,
       follow: 20,
       compress: true,
       counter: 0,
       agent: undefined,
       formData: [Function: formData],
       [Symbol(Body internals)]: [Object],
       [Symbol(Request internals)]: [Object]
     },
     operationName: 'listMembers',
     query: 'query listMembers {\n' +
       '\tmembers {\n' +
       '\t\tkey\n' +
       '\t\tusername\n' +
       '\t\tname\n' +
       '\t\temail\n' +
       '\t\tphone\n' +
       '\t\tpictureUrl\n' +
       '\t\tcreatedDate\n' +
       '\t}\n' +
       '}\n',
     variables: undefined,
     extensions: undefined,
     req: _Request {
       id: 'req-1',
       context: [Context],
       params: {},
       raw: [IncomingMessage],
       query: {},
       log: [EventEmitter],
       body: [Object],
       corsPreflightEnabled: false,
       tmpUploads: null,
       [Symbol(fastify.RequestPayloadStream)]: [IncomingMessage]
     },
     reply: _Reply {
       raw: [ServerResponse],
       request: [_Request],
       log: [EventEmitter],
       [Symbol(fastify.reply.isError)]: false,
       [Symbol(fastify.reply.errorHandlerCalled)]: false,
       [Symbol(fastify.reply.hijacked)]: false,
       [Symbol(fastify.reply.serializer)]: null,
       [Symbol(fastify.reply.headers)]: [Object],
       [Symbol(fastify.reply.trailers)]: null,
       [Symbol(fastify.reply.startTime)]: 5217038.930842,
       [Symbol(fastify.reply.endTime)]: undefined
     },
     user: {
       _key: '36a0e51f-7a27-4aa9-9810-3cfe1552eef3',
       name: 'Vignesh T.V',
       username: 'vignesh',
       email: '[email protected]'
     },
     tenant: {
       activeWorkspaceKey: '9c2456b7-1041-4314-97ec-0dd944304e00',
       tenantURI: 'tenant-1'
     },
     workspace: WorkspaceDB {
       url: 'http://core-tenant-arangodb:8529',
       workspaceURI: 'test-wspace3',
       dbname: 'tcnKyzgHSYogsZXT0',
       dbusername: 'fRqRNNrpdda0wLp',
       dbpassword: 'h4kvLzfnvahDGxU',
       db: [Database],
       entity: [Entity],
       graph: [TCGraph]
     },
     'ɵgetModuleContext': [Function: getModuleContext],
     injector: ReflectiveInjector {
       _constructionCounter: 2,
       _executionContextGetter: [Function: notInExecutionContext],
       displayName: 'Module "workspace" (Operation Scope)',
       _parent: [ReflectiveInjector],
       _fallbackParent: [ReflectiveInjector],
       _providers: [Array],
       _globalProvidersMap: Map(0) {},
       _keyIds: [Array],
       _objs: [Array]
     },
     moduleId: 'workspace',
     [Symbol(promPluginExecutionStartTimeSymbol)]: 1662101799701,
     [Symbol(rawDocument)]: 'query listMembers {\n' +
       '\tmembers {\n' +
       '\t\tkey\n' +
       '\t\tusername\n' +
       '\t\tname\n' +
       '\t\temail\n' +
       '\t\tphone\n' +
       '\t\tpictureUrl\n' +
       '\t\tcreatedDate\n' +
       '\t}\n' +
       '}\n',
     [Symbol(promPluginContext)]: {
       document: [Object],
       operationName: 'listMembers',
       operationType: 'query'
     }
   },
   member: Member {
     context: {
       request: [Request],
       operationName: 'listMembers',
       query: 'query listMembers {\n' +
         '\tmembers {\n' +
         '\t\tkey\n' +
         '\t\tusername\n' +
         '\t\tname\n' +
         '\t\temail\n' +
         '\t\tphone\n' +
         '\t\tpictureUrl\n' +
         '\t\tcreatedDate\n' +
         '\t}\n' +
         '}\n',
       variables: undefined,
       extensions: undefined,
       req: [_Request],
       reply: [_Reply],
       user: [Object],
       tenant: [Object],
       workspace: [WorkspaceDB],
       'ɵgetModuleContext': [Function: getModuleContext],
       injector: [ReflectiveInjector],
       moduleId: 'member',
       [Symbol(promPluginExecutionStartTimeSymbol)]: 1662101799701,
       [Symbol(rawDocument)]: 'query listMembers {\n' +
         '\tmembers {\n' +
         '\t\tkey\n' +
         '\t\tusername\n' +
         '\t\tname\n' +
         '\t\temail\n' +
         '\t\tphone\n' +
         '\t\tpictureUrl\n' +
         '\t\tcreatedDate\n' +
         '\t}\n' +
         '}\n',
       [Symbol(promPluginContext)]: [Object],
       [Symbol(GRAPHQL_MODULES)]: [Object],
       [Symbol(RESOLVERS_HOOKS)]: [Array]
     },
     data: Data { context: [Object], db: [Database] }
   },
   entity: Entity {
     db: Database {
       _analyzers: Map(0) {},
       _collections: [Map],
       _graphs: [Map],
       _views: Map(0) {},
       _connection: [Connection],
       _name: 'tcnKyzgHSYogsZXT0'
     },
     member: Member {
       modelName: 'member',
       collection: [Collection],
       workspaceDB: [Database]
     },
     workspace: Workspace {
       modelName: 'workspace',
       collection: [Collection],
       workspaceDB: [Database]
     },
     installedChannel: InstalledChannel {
       modelName: 'installed-channel',
       collection: [Collection],
       workspaceDB: [Database]
     },
     workspaceMember: WorkspaceMember {
       modelName: 'workspace_member',
       collection: [Collection],
       workspaceDB: [Database]
     },
     event: Event {
       modelName: 'event',
       collection: [Collection],
       workspaceDB: [Database]
     },
     channelToEvents: InstalledChannelToEvent {
       modelname: 'installed_channel_to_event',
       collection: [Collection],
       workspaceDB: [Database]
     },
     page: Page {
       modelName: 'page',
       collection: [Collection],
       workspaceDB: [Database]
     },
     pageVersion: PageVersion {
       modelName: 'pageVersion',
       collection: [Collection],
       workspaceDB: [Database]
     },
     pageVersionEdge: VersionsInPageEdge {
       modelName: 'page_version_edge',
       collection: [Collection],
       workspaceDB: [Database]
     },
     childOfEntityEdge: ChildOfEntityEdge {
       modelName: 'child_entity_edge',
       collection: [Collection],
       workspaceDB: [Database]
     }
   },
   data: Data {
     context: {
       request: [Request],
       operationName: 'listMembers',
       query: 'query listMembers {\n' +
         '\tmembers {\n' +
         '\t\tkey\n' +
         '\t\tusername\n' +
         '\t\tname\n' +
         '\t\temail\n' +
         '\t\tphone\n' +
         '\t\tpictureUrl\n' +
         '\t\tcreatedDate\n' +
         '\t}\n' +
         '}\n',
       variables: undefined,
       extensions: undefined,
       req: [_Request],
       reply: [_Reply],
       user: [Object],
       tenant: [Object],
       workspace: [WorkspaceDB],
       'ɵgetModuleContext': [Function: getModuleContext],
       injector: [ReflectiveInjector],
       moduleId: 'workspace',
       [Symbol(promPluginExecutionStartTimeSymbol)]: 1662101799701,
       [Symbol(rawDocument)]: 'query listMembers {\n' +
         '\tmembers {\n' +
         '\t\tkey\n' +
         '\t\tusername\n' +
         '\t\tname\n' +
         '\t\temail\n' +
         '\t\tphone\n' +
         '\t\tpictureUrl\n' +
         '\t\tcreatedDate\n' +
         '\t}\n' +
         '}\n',
       [Symbol(promPluginContext)]: [Object]
     },
     member: Member { context: [Object], data: [Data] },
     db: Database {
       _analyzers: Map(0) {},
       _collections: [Map],
       _graphs: [Map],
       _views: Map(0) {},
       _connection: [Connection],
       _name: 'tcnKyzgHSYogsZXT0'
     }
   }
 }

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

1 participant