@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 usinga.ref()&a.ref().array() - There is a 3rd model table using
a.model() - A custom query references the
a.model()table asdataSourceand one of thea.customTypes()asreturns()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.