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

feat(condo): DOMA-10226 add full stacked gql error traces #5243

Open
wants to merge 43 commits into
base: main
Choose a base branch
from

Conversation

pahaz
Copy link
Member

@pahaz pahaz commented Sep 16, 2024

Improve developer experience. And show what the real original error. And provide a full stack trace with internal and intermediate errors.
Screenshot 2024-10-03 at 13 11 40

    GQLError: [error] Create Meter internal error
        at _throwIfError (~/packages/codegen/generate.server.utils.js:67:15)
        at _throwIfError (~/packages/codegen/generate.server.utils.js:140:5)
        at runMicrotasks (<anonymous>)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
        at Object.create (~/packages/codegen/generate.server.utils.js:213:16)
        at resolver (~/apps/condo/domains/meter/schema/RegisterMetersReadingsService.js:397:50)
    ^- Caused By: Error: Unable to connect a Meter.resource<MeterResource>
        at ~/node_modules/@keystonejs/keystone/lib/ListTypes/utils.js:44:23
        at runMicrotasks (<anonymous>)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
        at List._resolveRelationship (~/node_modules/@keystonejs/keystone/lib/ListTypes/list.js:617:35)
        at ~/node_modules/@keystonejs/keystone/lib/ListTypes/list.js:741:26
        at List._nestedMutation (~/node_modules/@keystonejs/keystone/lib/ListTypes/list.js:683:35)
        at List._createSingle (~/node_modules/@keystonejs/keystone/lib/ListTypes/list.js:733:12)
        at List.createMutation (~/node_modules/@keystonejs/keystone/lib/ListTypes/list.js:713:12)
        at List.createMutation (~/packages/keystone/requestCache.js:151:16)
        at execGqlWithoutAccess (~/packages/codegen/generate.server.utils.js:131:30)
        at Object.create (~/packages/codegen/generate.server.utils.js:213:16)
        at resolver (~/apps/condo/domains/meter/schema/RegisterMetersReadingsService.js:397:50)
    ^- Caused By: Error: Unable to connect a Meter.resource<MeterResource>
        at throwWithErrors (~/node_modules/@keystonejs/fields/dist/fields.cjs.dev.js:1949:17)
        at resolveNestedSingle (~/node_modules/@keystonejs/fields/dist/fields.cjs.dev.js:2183:7)
        at runMicrotasks (<anonymous>)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
        at resolveNested (~/node_modules/@keystonejs/fields/dist/fields.cjs.dev.js:2230:10)
        at Relationship.resolveNestedOperations (~/node_modules/@keystonejs/fields/dist/fields.cjs.dev.js:2475:9)
        at ~/node_modules/@keystonejs/keystone/lib/ListTypes/list.js:620:61
        at Object.pReflect [as default] (~/node_modules/p-reflect/index.js:5:17)
        at async Promise.all (index 3)
        at resolveAllKeys (~/node_modules/@keystonejs/utils/dist/utils.cjs.dev.js:42:19)
        at List._resolveRelationship (~/node_modules/@keystonejs/keystone/lib/ListTypes/list.js:617:35)
        at ~/node_modules/@keystonejs/keystone/lib/ListTypes/list.js:741:26
        at List._nestedMutation (~/node_modules/@keystonejs/keystone/lib/ListTypes/list.js:683:35)
        at List._createSingle (~/node_modules/@keystonejs/keystone/lib/ListTypes/list.js:733:12)
        at List.createMutation (~/node_modules/@keystonejs/keystone/lib/ListTypes/list.js:713:12)
        at List.createMutation (~/packages/keystone/requestCache.js:151:16)
        at execGqlWithoutAccess (~/packages/codegen/generate.server.utils.js:131:30)
        at Object.create (~/packages/codegen/generate.server.utils.js:213:16)
        at resolver (~/apps/condo/domains/meter/schema/RegisterMetersReadingsService.js:397:50)
    ^- Caused By: AccessDeniedError: You do not have access to this resource
        at throwAccessDenied (~/node_modules/@keystonejs/keystone/lib/ListTypes/graphqlErrors.js:17:9)
        at _throwAccessDenied (~/node_modules/@keystonejs/keystone/lib/ListTypes/list.js:387:7)
        at List.getAccessControlledItem (~/node_modules/@keystonejs/keystone/lib/ListTypes/list.js:422:7)
        at runMicrotasks (<anonymous>)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
        at List.itemQuery (~/node_modules/@keystonejs/keystone/lib/ListTypes/list.js:527:20)
        at List.itemQuery (~/packages/keystone/requestCache.js:196:16)
        at resolveNestedSingle (~/node_modules/@keystonejs/fields/dist/fields.cjs.dev.js:2179:14)
        at resolveNested (~/node_modules/@keystonejs/fields/dist/fields.cjs.dev.js:2230:10)
        at Relationship.resolveNestedOperations (~/node_modules/@keystonejs/fields/dist/fields.cjs.dev.js:2475:9)
        at ~/node_modules/@keystonejs/keystone/lib/ListTypes/list.js:620:61
        at Object.pReflect [as default] (~/node_modules/p-reflect/index.js:5:17)
        at async Promise.all (index 3)
        at resolveAllKeys (~/node_modules/@keystonejs/utils/dist/utils.cjs.dev.js:42:19)
        at List._resolveRelationship (~/node_modules/@keystonejs/keystone/lib/ListTypes/list.js:617:35)
        at ~/node_modules/@keystonejs/keystone/lib/ListTypes/list.js:741:26
        at List._nestedMutation (~/node_modules/@keystonejs/keystone/lib/ListTypes/list.js:683:35)
        at List._createSingle (~/node_modules/@keystonejs/keystone/lib/ListTypes/list.js:733:12)
        at List.createMutation (~/node_modules/@keystonejs/keystone/lib/ListTypes/list.js:713:12)
        at List.createMutation (~/packages/keystone/requestCache.js:151:16)
        at execGqlWithoutAccess (~/packages/codegen/generate.server.utils.js:131:30)
        at Object.create (~/packages/codegen/generate.server.utils.js:213:16)
        at resolver (~/apps/condo/domains/meter/schema/RegisterMetersReadingsService.js:397:50)

@pahaz pahaz changed the title refactor(condo): DOMA-10227 remove ensure-error feat(condo): DOMA-10226 add full stacked gql error traces Sep 20, 2024
@pahaz pahaz marked this pull request as draft September 20, 2024 21:31
…or: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run
@SavelevMatthew
Copy link
Member

Can you explain translations part a bit? Should I add some keys on per-app basis? What's the en.json in KS is used for? Only tests? Because I (probably) don't want to merge KS translations with app ones 🤔

@pahaz
Copy link
Member Author

pahaz commented Oct 3, 2024

Can you explain translations part a bit? Should I add some keys on per-app basis? What's the en.json in KS is used for? Only tests? Because I (probably) don't want to merge KS translations with app ones 🤔

Yes, unfortunately, it's just for tests. It's because of const { getTranslations } = require('@open-condo/locales/loader')

I've dropped it and mocked the @open-condo/locales/loader function because it's a spec.js

Copy link

sonarcloud bot commented Oct 3, 2024

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

Successfully merging this pull request may close these issues.

4 participants