redwood
redwood copied to clipboard
[Bug?]: `getAuthProviderHeader` does not support getting headers from a plain `Request` object
What's not working?
The current definition of getAuthProviderHeader
says it supports getting the auth provider header from a APIGatewayProxyEvent
or Request
:
export const getAuthProviderHeader = (
event: APIGatewayProxyEvent | Request,
) => {
This works as expected for APIGatewayProxyEvent
, but not for Request
.
How do we reproduce the bug?
import { getAuthProviderHeader } from '@redwoodjs/api'
const testRequest = new Request('https://redwoodjs.com/')
testRequest.headers.append('auth-provider', 'test')
const authProvider = getAuthProviderHeader(request))
In the above example, authProvider
should be test
, but it is undefined
.
What's your environment? (If it applies)
System:
OS: Linux 6.10 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
Shell: 5.1.4 - /bin/bash
Binaries:
Node: 20.14.0 - /tmp/xfs-54a3a8c7/node
Yarn: 4.4.0 - /tmp/xfs-54a3a8c7/yarn
npmPackages:
@redwoodjs/auth-dbauth-setup: 8.3.0 => 8.3.0
@redwoodjs/cli-data-migrate: 8.3.0 => 8.3.0
@redwoodjs/cli-storybook-vite: 8.3.0 => 8.3.0
@redwoodjs/core: 8.3.0 => 8.3.0
@redwoodjs/realtime: 8.3.0 => 8.3.0
@redwoodjs/studio: 12.0.0 => 12.0.0
redwood.toml:
[api]
port = 8911
[browser]
open = false
[experimental.opentelemetry]
enabled = false
[notifications]
versionUpdates = ["latest"]
[studio.graphiql.authImpersonation]
authProvider = "dbAuth"
email = "${AUTH_IMPERSONATION_USER_EMAIL}"
userId = "${AUTH_IMPERSONATION_USER_ID}"
[web]
title = "Local Public"
port = 8910
apiUrl = "${REDWOOD_API_URL}"
sourceMap = true
includeEnvironmentVariables = [
"APP_ENV",
"CLOUDFLARE_IMAGES_URL",
"PBS_OAUTH_BASE_URL",
"PBS_OAUTH_CLIENT_ID",
"PUBLIC_API_URL",
"SENTRY_DSN",
]
Are you interested in working on this?
- [X] I'm interested in working on this