Skip to content

Commit 959e908

Browse files
cannikinjtoar
authored andcommitted
Adds an existential check in case no query vars are present in dbAuth invocation (#10204)
1 parent d0a0c07 commit 959e908

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.changesets/10204.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- chore(dbAuth): restore behavior of checking whether a search query is present
2+
3+
Previously dbAuth would check whether or not query string variables were
4+
present at all before invoking the proper function. During a refactor we
5+
updated this code to assume a query would *always* be present. Which it would be
6+
during normal browser behavior. But, we had a complaint from a user who relied
7+
on this optional check in one of their tests. So we're restoring the optional
8+
check here.

packages/auth-providers/dbAuth/api/src/DbAuthHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,7 @@ export class DbAuthHandler<
14561456
// figure out which auth method we're trying to call
14571457
async _getAuthMethod() {
14581458
// try getting it from the query string, /.redwood/functions/auth?method=[methodName]
1459-
let methodName = this.normalizedRequest.query.method as AuthMethodNames
1459+
let methodName = this.normalizedRequest.query?.method as AuthMethodNames
14601460

14611461
if (
14621462
!DbAuthHandler.METHODS.includes(methodName) &&

0 commit comments

Comments
 (0)