Hi, I am new to NestJS, so I hope this issue is not my mistake. I think NestJS's GraphQL module does not support resolvers that returns observables. This is kind of unexpected as the REST counterpart (i.e. controllers) supports observables.
With heyPromise, I am able to get 'from promise'. However, heyObservable returns this instead:
{
"data": {
"heyObservable": "[object Object]"
}
}
The expected data for heyObservable should be 'from rxjs'. For now, we will need to workaround by turning the observable into a promise (i.e. heyObservable_workaround_is_ok)
Snippet of schema & resolvers used:
type Query {
heyPromise: String
heyObservable: String
}
@Query()
async heyPromise () {
return new Promise(resolve => resolve('from promise'))
}
@Query()
heyObservable () {
return of('from rxjs')
}
@Query()
heyObservable_workaround_is_ok () {
return of('from rxjs').toPromise()
}
This feature is available in the latest version of the package.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
This feature is available in the latest version of the package.