Skip to content
This repository was archived by the owner on Dec 8, 2021. It is now read-only.
This repository was archived by the owner on Dec 8, 2021. It is now read-only.

graphqlgen gives UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'map' of undefined #449

@devautor

Description

@devautor

EDIT: This issue was actually happening with version 0.4.0 which I was unknowingly executing with graphqlgen (global install), and realised when I did npx graphqlgen. Actual issue as the subject reads has been reported in this comment, and is requested to be taken up from there.

Kindly find a reproduction throwing this error here: https://github.com/devautor/graphqlgen-repro-unhandledPromise

graphqlgen execution gives me this error trace (out of heap memory):

G:\apollo\prod\apollo-server>graphqlgen

<--- Last few GCs --->

[28164:00000205D273F330]   360312 ms: Mark-sweep 1179.9 (1220.6) -> 1179.9 (1220.6) MB, 342.1 / 0.0 ms  allocation failure GC in old space requested[28164:00000205D273F330]   360658 ms: Mark-sweep 1179.9 (1220.6) -> 1179.9 (1186.6) MB, 346.2 / 0.0 ms  last resort GC in old space requested
[28164:00000205D273F330]   361001 ms: Mark-sweep 1179.9 (1186.6) -> 1179.9 (1186.6) MB, 342.7 / 0.0 ms  last resort GC in old space requested
<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 000002446BAA5879 <JSObject>
    0: builtin exit frame: concat(this=000003DD60626801 <JSArray[30393831]>,00000081E787F9A9 <JSArray[8603361]>)

    1: flatten(aka flatten) [C:\Users\gaurav\AppData\Roaming\npm\node_modules\graphqlgen\dist\utils.js:~49] [pc=000003129AB542C3](this=00000214B0A822D1 <undefined>,a=000003DD60626801 <JSArray[30393831]>,b=00000081E787F9A9 <JSArray[8603361]>)
    2: arguments adaptor frame: 4->2
   ...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node_module_register
 2: v8::internal::FatalProcessOutOfMemory
 3: v8::internal::FatalProcessOutOfMemory
 4: v8::internal::Factory::NewUninitializedFixedArray
 5: v8::internal::Factory::NewJSArrayStorage
 6: v8::internal::WasmDebugInfo::SetupForTesting
 7: v8_inspector::protocol::Debugger::API::SearchMatch::fromJSONString
 8: v8_inspector::protocol::Debugger::API::SearchMatch::fromJSONString
 9: v8_inspector::protocol::Debugger::API::SearchMatch::fromJSONString
10: 000003129AA06B21

G:\apollo\prod\apollo-server>

Also, for comparison, graphql-code-generator generates model types and resolvers from the same schema file successfully:

$ gql-gen
  √ Parse configuration
  √ Generate outputs
Done in 4.24s.

Issue #310 earlier reported that this happens with huge schema, so to put in context, my schema.graphql is about 4k loc (introspected and downloaded from prisma-playground). Also, I am not using graphql-import, but typescript files to define schema, and prisma generated types are not imported, but reused (since that issue mentions that as a possible source of error). Against this comment by @victorkangsh, I too am reusing nested structure from primsa input types.

Note: This has earlier been reported in issue #436 and was suggested to be posted independently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions