j
Is this wrapped in a try/catch?
z
Yes it is
j
can you paste the whole function?
z
Check the updated snippet
j
if you run it in a debugger, is
organization
undefined?
createOrganizaion
returns what?
z
No it returns an organization type
createOrganization(data: OrganizationCreateInput!): Organization!
j
it'll console.log that?
I see you didn't pass in
info
. I'm not sure how it'll behave
z
{ deletedAt: null, city: 'DemoCity', name: 'Master', telephoneNumber: '+2547100000000', email: 'johndoe@gmail.com', zipCode: '00100', country: null, id: 'cjuk0bkam3wh60b29afq6krdo', countryCode: null, countryCurrencyCode: null, address: 'Plaza', street: 'Avenue' }
Should I be passing info yet am not using it?
j
ok, so it returned the whole object
Copy code
return {
            organization: {organization}
        }
maybe this line
return organization
or
return {organization}
z
return {organization} or return organization
return {organization} still throws that error
j
maybe related, why do you have the ts-ignore?
z
ts-ignore is to solve the issue with type-safety for Context
j
change to
export const createOrganization = async (args, context):Organization => {
z
Let me try
this works:
return organization
I wonder why
j
because of
createOrganization(data: OrganizationCreateInput!): Organization!
it's expecting an
Organization
type to be returned
not {organization: Organization}
z
I thought
return {organization}
is an organization type
j
it's nested down in the object
return {...organization}
would work too
z
oh got it, but that's weird, coz my other mutations eg. login I have nested the response like that and it works, wonder why this is different
j
¯\_(ツ)_/¯
check in the schema.graphql
maybe some are wrapped and this one isnt
z
Hehe
But this works for me
return {...organization}
Yeah I think that was the issue, thanks