You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a GraphQL with NestJS application and using dataloader.
Following documentation the loader function is being created on every request, just one time.
For certain calls we have two authentication methods: using regular JWT, and AWS Cognito tokens. I'm using loader.load method.
When using regular JWT, Dataloader is working as expected: the batch function is being called just once, with a list of keys.
However, when the request is authenticated by AWS Cognito, batch function is being callled n times - where n is the size of the list. On each execution, batch function is called with a list containing a single key.
I verified that this line: https://github.com/graphql/dataloader/blob/main/src/index.js#L293 is called for each item on the list when using AWS Cognito auth, and I'm not sure what is making this happen. When using regular JWT token, that line is called after all items are on the batch.keys list.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
hi there,
I'm working on a GraphQL with NestJS application and using dataloader.
Following documentation the loader function is being created on every request, just one time.
For certain calls we have two authentication methods: using regular JWT, and AWS Cognito tokens. I'm using
loader.load
method.When using regular JWT, Dataloader is working as expected: the batch function is being called just once, with a list of keys.
However, when the request is authenticated by AWS Cognito, batch function is being callled n times - where n is the size of the list. On each execution, batch function is called with a list containing a single key.
I verified that this line: https://github.com/graphql/dataloader/blob/main/src/index.js#L293 is called for each item on the list when using AWS Cognito auth, and I'm not sure what is making this happen. When using regular JWT token, that line is called after all items are on the
batch.keys
list.Is there a way to control that?
Beta Was this translation helpful? Give feedback.
All reactions