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

Allow string userId in Redwood Studio generated dbAuth header #8083

Merged
merged 3 commits into from
Apr 25, 2023

Conversation

davidkus
Copy link
Contributor

Problem

When using String type as your User's id field (with dbAuth), your session token would include a non-numeric id. However, Redwood Studio's GraphQL explorer could not generate session token with non-numeric id, it was requiring an Int.

Solution

Allow string id to be used in session token creation for Redwood Studio GraphQL. Check if value is numeric and if so, use parseInt, otherwise use the provided string.

Test Plan

Before (with String id):

Screen.Recording.2023-04-22.at.11.57.45.PM.mov

After (with String id):

Screen.Recording.2023-04-22.at.11.49.53.PM.mov

After (with Int id):

Screen.Recording.2023-04-22.at.11.37.43.PM.mov

@Josh-Walker-GM
Copy link
Collaborator

Thanks @davidkus! I'll take a look at this tomorrow and confirm with the others to get this merged 🚀

@Josh-Walker-GM Josh-Walker-GM added the release:fix This PR is a fix label Apr 24, 2023
@replay-io
Copy link

replay-io bot commented Apr 24, 2023

16 replays were recorded for 29595c8.

image 0 Failed
image 16 Passed
    requireAuth graphql checks
          ```
          locator.waitFor: Target closed
          =========================== logs ===========================
          waiting for locator('.rw-form-error-title').locator('text=You don\'t have permission to do that') to be visible
          ============================================================
          ```
        </ol>
      </details>
      <li><a href=https://app.replay.io/recording/0d1fc7d7-9eab-47e3-aa51-1dc7de41f49a>useAuth hook, auth redirects checks</a></li>
      <li><a href=https://app.replay.io/recording/018187f1-b6b8-48e2-aa56-cf2965505ce4>Check that a specific blog post is prerendered</a></li>
      <li><a href=https://app.replay.io/recording/a3c09502-86c7-400b-b751-702c8466b1b2>Check that about is prerendered</a></li>
      <li><a href=https://app.replay.io/recording/ec7701c5-8028-4e3a-926c-93659261ede6>Check that homepage is prerendered</a></li>
      <li><a href=https://app.replay.io/recording/4603e7a3-923c-4530-a2ca-577fc1626ccb>Check that meta-tags are rendering the correct dynamic data</a></li>
      <li><a href=https://app.replay.io/recording/decf03c4-dda5-47bf-879c-0c80a44c8134>Check that you can navigate from home page to specific blog post</a></li>
      <li><a href=https://app.replay.io/recording/a12c80d5-23ae-4bc6-aac5-ecef367fb25e>Waterfall prerendering (nested cells)</a></li>
      <li><a href=https://app.replay.io/recording/4f7a3b73-608c-4c9c-834c-ac865d22cce5>RBAC: Admin user should be able to delete contacts</a></li>
      <li><a href=https://app.replay.io/recording/17d63a75-a11e-4ba4-b446-65f30d696632>RBAC: Should not be able to delete contact as non-admin user</a></li>
      <li><a href=https://app.replay.io/recording/53eafac8-0204-40a9-b4f8-5ba580523109>Smoke test with dev server</a></li>
      <li><a href=https://app.replay.io/recording/0e0b6f31-2ad6-49a0-a3a8-8d8ab3da3bc8>Smoke test with rw serve</a></li>
      <li><a href=https://app.replay.io/recording/698b4f68-ffa6-404a-8164-5d1a4b10f0bd>Loads Cell mocks when Cell is nested in another story</a></li>
      <li><a href=https://app.replay.io/recording/78937c89-de37-4505-b8ad-8a6fcd9068a0>Loads Cell Stories</a></li>
      <li><a href=https://app.replay.io/recording/3893460b-59cf-492f-9eec-63727d750315>Loads MDX Stories</a></li>
      <li><a href=https://app.replay.io/recording/348d7863-8c2f-42e2-ae3a-01d5c653e89d>Mocks current user, and updates UI while dev server is running</a></li>
      

View test run on Replay ↗︎

@Josh-Walker-GM Josh-Walker-GM merged commit 22c950a into redwoodjs:main Apr 25, 2023
@redwoodjs-bot redwoodjs-bot bot added this to the next-release milestone Apr 25, 2023
@Josh-Walker-GM
Copy link
Collaborator

Thanks again @davidkus!

If you have any feedback about studio on the graphiql interface or any other features, good or bad, we'd love to hear about it here: https://community.redwoodjs.com/t/redwood-studio-experimental/4771

@Josh-Walker-GM Josh-Walker-GM linked an issue Apr 25, 2023 that may be closed by this pull request
1 task
@davidkus davidkus deleted the rw-studio-dbauth-header branch April 26, 2023 05:00
@jtoar jtoar modified the milestones: next-release, v5.0.0 Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:fix This PR is a fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug?]: yarn redwood setup graphiql doesn't work for string ids
3 participants