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 API query fails with error ""Cannot read properties of undefined (reading 'fromField')"" #8571

Open
rob-luke opened this issue Nov 18, 2024 · 6 comments

Comments

@rob-luke
Copy link
Contributor

Bug Description

After updating to v0.32.4 (big thank you @charlesBochet !!!), I am unable to use the graphql api interface.

If I try by the web interface it fails like this...

Image

and I get the following errors in the logs

Exception Captured

  {

    operation: { name: 'FindCompany', type: 'query' },

    document: 'query FindCompany {\n' +

      '  companies(filter: {name: {startsWith: "Twenty"}}) {\n' +

      '    edges {\n' +

      '      node {\n' +

      '        id\n' +

      '        name\n' +

      '      }\n' +

      '    }\n' +

      '  }\n' +

      '}',

    user: undefined

  }

  [

    TypeError: Cannot read properties of undefined (reading 'fromField')

        at ProcessAggregateHelper.addSelectedAggregatedFieldsQueriesToQueryBuilder (/app/packages/twenty-server/dist/src/engine/api/graphql/graphql-query-runner/helpers/process-aggregate.helper.js:16:78)

        at GraphqlQueryFindManyResolverService.resolve (/app/packages/twenty-server/dist/src/engine/api/graphql/graphql-query-runner/resolvers/graphql-query-find-many-resolver.service.js:85:32)

        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

        at async GraphqlQueryRunnerService.executeQuery (/app/packages/twenty-server/dist/src/engine/api/graphql/graphql-query-runner/graphql-query-runner.service.js:135:25)

        at async descriptor.value (/app/packages/twenty-server/dist/src/engine/decorators/observability/log-execution-time.decorator.js:18:28)

        at async Object.companies (/app/packages/twenty-server/dist/src/engine/api/graphql/workspace-resolver-builder/factories/find-many-resolver.factory.js:34:24)

        at async field.resolve (/app/node_modules/@envelop/on-resolve/cjs/index.js:36:42)

        at async /app/node_modules/@graphql-tools/executor/cjs/execution/promiseForObject.js:18:35

        at async Promise.all (index 0) {

      path: undefined,

      locations: undefined,

      extensions: {

        code: 'INTERNAL_SERVER_ERROR',

        response: "Cannot read properties of undefined (reading 'fromField')"

      }

    }

  ]

The same thing happens if I call the api via code.

Expected behavior

The query should run without an exception in the logs.

Conclusion

Thank you for the help. Please let me know if I can provide additional information.

@rob-luke
Copy link
Contributor Author

Incase its relevant, I am also seeing this error in the logs

[Nest] 1  - 11/18/2024, 11:52:14 PM     LOG [GraphqlQueryRunnerService:findMany] Execution time: 81.30ms

fetching object metadata: 139.1ms

generating object metadata map: 1.451ms

[Nest] 1  - 11/19/2024, 1:37:04 AM     LOG [WorkspaceMetadataCacheService:recomputeMetadataCache] Execution time: 194.75ms

Exception Captured

  { user: undefined }

  [

    GraphqlQueryRunnerException [Error]: Object metadata collection not found

        at WorkspaceSchemaFactory.createGraphQLSchema (/app/packages/twenty-server/dist/src/engine/api/graphql/workspace-schema.factory.js:53:19)

        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

        at async GraphQLConfigService.createSchema (/app/packages/twenty-server/dist/src/engine/api/graphql/graphql-config/graphql-config.service.js:174:16)

        at async conditionalSchema (/app/packages/twenty-server/dist/src/engine/api/graphql/graphql-config/graphql-config.service.js:112:28)

        at async schema (/app/node_modules/@graphql-yoga/nestjs/dist/cjs/index.js:68:95)

        at async onRequestParseDone (/app/node_modules/graphql-yoga/cjs/plugins/use-schema.js:39:36)

        at async YogaServer.handle (/app/node_modules/graphql-yoga/cjs/server.js:70:17) {

      code: 'METADATA_CACHE_VERSION_NOT_FOUND'

    }

  ]

[Nest] 1  - 11/19/2024, 1:38:08 AM     LOG [TypeDefinitionsGenerator] Generating composite type objects: [LINKS, CURRENCY, FULL_NAME, ADDRESS, ACTOR, EMAILS, PHONES]

[Nest] 1  - 11/19/2024, 1:38:08 AM     LOG [TypeDefinitionsGenerator] Generating metadata objects: [messageChannelMessageAssociation, timelineActivity, person, opportunity, apiKey, viewFilter, auditLog, attachment, blocklist, calendarEvent, calendarChannel, calendarChannelEventAssociation, calendarEventParticipant, messageChannel, connectedAccount, favorite, viewField, viewSort, view, webhook, workspaceMember, messageThread, message, messageParticipant, company, note, noteTarget, task, taskTarget, viewGroup, viewFilterGroup]

@charlesBochet
Copy link
Member

@rob-luke I'm a bit worried you might actually have main / 0.33-canary version (which is unstable). I'll look into what has been push behind v0.32.4 today

@rob-luke
Copy link
Contributor Author

I just triple confirmed and I am using image image: twentycrm/twenty:v0.32.4, so it may be as you suspected, that something in main leaked in to the release. @charlesBochet

@rob-luke
Copy link
Contributor Author

Hi @charlesBochet I did some more digging in to this.

  • I reverted to v0.32.3 and everything works as expected.
  • I cleaned my images and updated to v0.32.4 and the issues came back.
    So I suspect its got something to do with v0.32.4 specifically

@charlesBochet
Copy link
Member

Yes we have an issue with v0.32.4, I'm investigating

@rob-luke
Copy link
Contributor Author

Thanks. Let me know if I can help.

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

No branches or pull requests

2 participants