Skip to content

Commit

Permalink
Adds an existential check in case no query vars are present in dbAuth…
Browse files Browse the repository at this point in the history
… invocation (#10204)
  • Loading branch information
cannikin authored and jtoar committed Mar 12, 2024
1 parent d0a0c07 commit 959e908
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .changesets/10204.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- chore(dbAuth): restore behavior of checking whether a search query is present

Previously dbAuth would check whether or not query string variables were
present at all before invoking the proper function. During a refactor we
updated this code to assume a query would *always* be present. Which it would be
during normal browser behavior. But, we had a complaint from a user who relied
on this optional check in one of their tests. So we're restoring the optional
check here.
2 changes: 1 addition & 1 deletion packages/auth-providers/dbAuth/api/src/DbAuthHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,7 @@ export class DbAuthHandler<
// figure out which auth method we're trying to call
async _getAuthMethod() {
// try getting it from the query string, /.redwood/functions/auth?method=[methodName]
let methodName = this.normalizedRequest.query.method as AuthMethodNames
let methodName = this.normalizedRequest.query?.method as AuthMethodNames

if (
!DbAuthHandler.METHODS.includes(methodName) &&
Expand Down

0 comments on commit 959e908

Please sign in to comment.