Webtomizer / typeorm-loader

A database-aware data-loader for use with GraphQL and TypeORM.
82 stars 8 forks source link

Maximum call stack size exceeded #6

Open moltar opened 5 years ago

moltar commented 5 years ago

Getting the following error on a very simple test:

    RangeError: Maximum call stack size exceeded
        at String.indexOf (<anonymous>)
        at Function.QueryBuilderUtils.isAliasProperty (.../src/query-builder/QueryBuilderUtils.ts:13:44)
        at JoinAttribute.get [as parentAlias] (.../src/query-builder/JoinAttribute.ts:112:32)
        at JoinAttribute.getValue (.../src/query-builder/JoinAttribute.ts:146:93)
        at JoinAttribute.get [as relation] (.../src/query-builder/JoinAttribute.ts:162:53)
        at JoinAttribute.get [as metadata] (.../src/query-builder/JoinAttribute.ts:175:18)
        at SelectQueryBuilder.join (.../src/query-builder/SelectQueryBuilder.ts:1299:27)
        at SelectQueryBuilder.leftJoin (.../src/query-builder/SelectQueryBuilder.ts:284:14)
        at .../node_modules/typeorm-loader/src/select.ts:137:17
        at Array.forEach (<anonymous>)
        at select (.../node_modules/typeorm-loader/src/select.ts:127:15)
        at .../node_modules/typeorm-loader/src/select.ts:138:14
        at Array.forEach (<anonymous>)
        at select (.../node_modules/typeorm-loader/src/select.ts:127:15)
        at .../node_modules/typeorm-loader/src/select.ts:138:14
        at Array.forEach (<anonymous>)
        at select (.../node_modules/typeorm-loader/src/select.ts:127:15)
        at .../node_modules/typeorm-loader/src/select.ts:138:14
        at Array.forEach (<anonymous>)
        at select (.../node_modules/typeorm-loader/src/select.ts:127:15)
        at .../node_modules/typeorm-loader/src/select.ts:138:14
        at Array.forEach (<anonymous>)

const res = await loader.loadOne<Entity>(Entity, { id: '1' })

Any ideas?

Thanks.

amille14 commented 5 years ago

I ran into this when I didn't pass the info object into the loadOne function. Try something like this:

const res = await loader.loadOne<Entity>(Entity, { id: '1' }, info)