#✅ - Callstack size exceeded on one to many relationship with `customType`s

1 messages · Page 1 of 1 (latest)

brazen frigate
#

@brittle rose , @oblique iron, @slender raven - I was on the office hours call this morning and thought upgrading my packages had solved this issue. But as it turns out that was not the case. I have ran the issue down further and provided a reproducible repo.

TLDR - pushing out a deployment to sandbox causes a error when:

  • There is a one to many relationship between two customType()s using a.ref() & a.ref().array()
  • There is a 3rd model table using a.model()
  • A custom query references the a.model() table as dataSource and one of the a.customTypes() as returns() value.

Error Message:

Maximum call stack size exceeded
Caused By: Maximum call stack size exceeded

Resolution: Check your data schema definition for syntax and type errors.

Schema:

const schema = a.schema({
  MasterTenantTable: a.model({
    pk: a.string().required(),
    sk: a.string().required(),
    company_id: a.id(),
  })
  .authorization(allow=> [allow.publicApiKey()]),
  Tenant: a.customType({
    company: a.ref('Company'),
    company_id: a.id().required(),
  }),
  Company: a.customType({
    tenants: a.ref('Tenant').array(),
  }),
  getCompanyById: a.query()
    .arguments({company_id: a.id().required()})
    .returns(a.ref('Tenant').array())
    .authorization(allow=> [allow.authenticated()])
    .handler(a.handler.custom({
      dataSource: a.ref('MasterTenantTable'),
      entry: './company-resolvers/getCompanyById.js',
    })),
});

Repo reproduciton link:
https://github.com/jmarshall9120/AmplifySchemaTesting

Hoping I can get help with confirming weather this is a bug or not, and a solution / workaround. Thanks.

GitHub

Test for broken schema. Contribute to jmarshall9120/AmplifySchemaTesting development by creating an account on GitHub.

slender raven
brazen frigate
slender raven
#

looks like chris was able to reproduce this. the team should provide any updates on the issue. thank you for filing this.

spring pondBOT
#

✅ - Callstack size exceeded on one to many relationship with customTypes