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

dbAuth Vercel Fix #3309

Merged
merged 6 commits into from Aug 31, 2021
Merged

dbAuth Vercel Fix #3309

merged 6 commits into from Aug 31, 2021

Conversation

cannikin
Copy link
Member

@cannikin cannikin commented Aug 30, 2021

Fixes two issues that Vercel was blowing up on:

  1. Vercel does not like having a return body that's JSON and turning it into a string for us—it MUST be a string
  2. If the body is empty, Vercel will still set isBase64Encoded to true, and you can't decode an empty string

Fixing these introduced another issue, where getToken returned an empty string which a client call for getUserMetadata interpreted as there being a user logged in and so would call the GraphQL endpoint for getCurrentUser, which then returned a 500. This is patched as well.

(Potential) Breaking Change

Serverless functions may already wait for async code to complete before returning (this hasn't been an issue in dev or a serverfull deployment). But in case they don't, anyone already using dbAuth should update their api/src/functions/auth.js to include an await on the final line of code:

Before:

return authHandler.invoke()

After:

return await authHandler.invoke()

@redwoodjs-bot redwoodjs-bot bot added this to New issues in Current-Release-Sprint Aug 30, 2021
@cannikin cannikin requested a review from dac09 August 30, 2021 20:52
@cannikin cannikin added this to the next-release milestone Aug 30, 2021
@cannikin cannikin added bug/confirmed We have confirmed this is a bug topic/auth release:breaking This PR is a breaking change labels Aug 30, 2021
Current-Release-Sprint automation moved this from New issues to Ready to merge Aug 31, 2021
@cannikin
Copy link
Member Author

Verified that deploy works to Netlify as well: https://jolly-bohr-d8f980.netlify.app/

@dac09
Copy link
Collaborator

dac09 commented Aug 31, 2021

LGTM! Thanks Lord Cannakin!

@dac09 dac09 merged commit 5aef1d1 into main Aug 31, 2021
Current-Release-Sprint automation moved this from Ready to merge to Done Aug 31, 2021
@dac09 dac09 deleted the rc-dbauth-vercel-fix branch August 31, 2021 16:48
@cannikin
Copy link
Member Author

cannikin commented Aug 31, 2021

That's Cann i kin! 😃

dac09 pushed a commit that referenced this pull request Sep 1, 2021
Co-authored-by: Rob Cameron <rob.cameron@fastmail.com>
@thedavidprice thedavidprice modified the milestones: next-release, v0.36.3 Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/confirmed We have confirmed this is a bug release:breaking This PR is a breaking change topic/auth
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants