Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix headers not being usable in sessionId template #5103

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mayrn-techdivision
Copy link

🚨 IMPORTANT: Please do not create a Pull Request without creating an issue first.

Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of
the pull request.

Description

Makes headers usable in session id when using node's fetch.

Fixes #5102
Related #4109

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

This has only been tested locally, I was not able to write a proper test case with a fetch Request object.

However you can reproduce it with the steps from #5102.

Test Environment:

  • OS: MacOS
  • @graphql-mesh/plugin-response-cache: 0.2.7
  • NodeJS: 16.x

Checklist:

  • I have followed the
    CONTRIBUTING doc and the
    style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests and linter rules pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@changeset-bot
Copy link

changeset-bot bot commented Feb 2, 2023

🦋 Changeset detected

Latest commit: 2e9caff

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@graphql-mesh/plugin-response-cache Patch
cloudflare-workers Patch
typescript-location-weather-example Patch
spacex-cfw Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mayrn-techdivision mayrn-techdivision marked this pull request as ready for review February 2, 2023 13:39
@ardatan
Copy link
Owner

ardatan commented Feb 2, 2023

Hmm we shouldn't need that actually;
https://github.com/Urigo/graphql-mesh/blob/master/packages/runtime/src/get-mesh.ts#L173
Then somehow this line doesn't work as it should be.

@mayrn-techdivision
Copy link
Author

mayrn-techdivision commented Feb 2, 2023

Maybe it's because we're not getting the "context" in the session callback but the actual request. This is from @graphql-yoga/plugin-response-cache which is calling the the session callback.
image

From what I can tell the context also isn't available there. And the same thing is basically the case with the enabled callback. All that's getting passed is the request.

@mayrn-techdivision
Copy link
Author

And the context only seems to be getting built after the sessionid and cache key were generated:

image

Should I report this bug for the yoga project instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot use headers in sessionId or cacheKey
2 participants