improve reporting resolver failures
- Dominant language
- Rust
- Stars
- 19k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
I was trying to introduce resolvers to `relayjs/relay-examples` (in the nextjs example, manually hacked around the haste style requires printed by the compiler). I couldn't figure out why things weren't working for the longest time. The resolver module factory was getting executed but the resolver function didn't. Noting down some thoughts here for future me.
* `__log` provided to environment didn't show anything. I later realized `requiredFieldLogger` reports it but I totally didn't consider using it before I understood why the resolver wasn't getting invoked (in fact, that's when I remembered us talking about reporting resolver errors via `requiredFieldLogger` in the past). `requiredFieldLogger` probably needs a rename. maybe worth thinking about reporting/logging interface more broadly too.
* I eventually figured out that the issue was caused by `export default function MyResolver...` and `resolverModule: require('...')` not playing well together. We don't attempt to unwrap default anywhere in `RelayReader`. We do in `loadEntryPoint` and `GraphQLTag`... probably worth having a utility function somewhere to share across all three and any future places we load modules.
Contributor guide
Assessment
This issue has not been assessed yet.