edwinn1337
08/08/2023, 12:13 PMrp_st
08/08/2023, 12:13 PMrp_st
08/08/2023, 12:14 PMedwinn1337
08/08/2023, 12:14 PMedwinn1337
08/08/2023, 12:15 PMedwinn1337
08/08/2023, 12:15 PMrp_st
08/08/2023, 12:15 PMedwinn1337
08/08/2023, 12:16 PMjs
import { signOut } from 'supertokens-web-js/recipe/thirdpartyemailpassword'
import { logError } from '../../shared/utils/logError'
export const useSignout = () => async () => {
try {
await signOut()
} catch (err) {
logError(err)
}
window.location.reload()
}
this is our signout logicedwinn1337
08/08/2023, 12:16 PMrp_st
08/08/2023, 12:17 PMedwinn1337
08/08/2023, 12:19 PMedwinn1337
08/08/2023, 12:19 PMrp_st
08/08/2023, 12:20 PMedwinn1337
08/08/2023, 12:20 PMjs
exposeAccessTokenToFrontendInCookieBasedAuth: true,
getTokenTransferMethod: () => 'any',
we use this in our backendConfigedwinn1337
08/08/2023, 12:23 PMedwinn1337
08/08/2023, 12:25 PMrp_st
08/08/2023, 12:27 PMedwinn1337
08/08/2023, 12:28 PMrp_st
08/08/2023, 12:28 PMrp_st
08/08/2023, 12:29 PMedwinn1337
08/08/2023, 12:29 PMedwinn1337
08/08/2023, 12:29 PMedwinn1337
08/08/2023, 12:29 PMrp_st
08/08/2023, 12:29 PMedwinn1337
08/08/2023, 12:29 PMrp_st
08/08/2023, 12:29 PMedwinn1337
08/08/2023, 12:30 PMrp_st
08/08/2023, 12:31 PMedwinn1337
08/08/2023, 12:31 PMedwinn1337
08/11/2023, 9:46 AMrp_st
08/11/2023, 9:57 AMedwinn1337
08/14/2023, 11:18 AMedwinn1337
08/14/2023, 11:18 AMrp_st
08/14/2023, 11:37 AMedwinn1337
08/14/2023, 11:42 AMedwinn1337
08/14/2023, 11:42 AMedwinn1337
08/14/2023, 11:46 AMedwinn1337
08/14/2023, 12:03 PMedwinn1337
08/14/2023, 12:03 PMrp_st
08/14/2023, 12:04 PMedwinn1337
08/14/2023, 12:04 PMjs
"supertokens-node": "14.1.2",
"supertokens-web-js": "0.6.0",
rp_st
08/14/2023, 12:04 PMedwinn1337
08/14/2023, 12:05 PMrp_st
08/14/2023, 12:05 PMedwinn1337
08/14/2023, 12:06 PMedwinn1337
08/14/2023, 12:15 PMedwinn1337
08/14/2023, 12:15 PMrp_st
08/14/2023, 12:15 PMedwinn1337
08/14/2023, 12:32 PMrp_st
08/14/2023, 12:33 PMrp_st
08/14/2023, 12:33 PMrp_st
08/14/2023, 12:33 PMedwinn1337
08/14/2023, 12:34 PMrp_st
08/14/2023, 12:34 PMedwinn1337
08/14/2023, 12:34 PMrp_st
08/14/2023, 12:35 PMedwinn1337
08/14/2023, 12:35 PMporcellus
08/14/2023, 12:47 PMjose
you have installed?porcellus
08/14/2023, 12:53 PMnode
version could be interesting as well.edwinn1337
08/14/2023, 2:20 PMedwinn1337
08/14/2023, 2:20 PMedwinn1337
08/14/2023, 2:21 PMporcellus
08/14/2023, 2:25 PMporcellus
08/14/2023, 2:27 PMjose@2.0.6
installed, but I guess that should be ok if the version we get is the right oneporcellus
08/14/2023, 2:27 PMedwinn1337
08/14/2023, 2:30 PMporcellus
08/14/2023, 2:31 PMedwinn1337
08/14/2023, 2:31 PMporcellus
08/14/2023, 2:32 PMsupertokens-node/lib/build/recipe/session/accessToken.js
file in your node_modules
porcellus
08/14/2023, 2:32 PMporcellus
08/14/2023, 2:33 PMlogDebugMessage("getInfoFromAccessToken: Returning TRY_REFRESH_TOKEN because access token validation failed - "...
logging the error being caughtporcellus
08/14/2023, 2:34 PMerr
object (incl. the stacktrace most importantly)porcellus
08/14/2023, 2:34 PMedwinn1337
08/14/2023, 2:37 PMporcellus
08/14/2023, 2:41 PMedwinn1337
08/14/2023, 2:48 PMporcellus
08/14/2023, 2:48 PMedwinn1337
08/14/2023, 2:49 PMedwinn1337
08/14/2023, 3:04 PMporcellus
08/14/2023, 3:07 PMedwinn1337
08/14/2023, 3:16 PMedwinn1337
08/14/2023, 3:17 PMedwinn1337
08/14/2023, 3:18 PMedwinn1337
08/14/2023, 3:20 PMporcellus
08/14/2023, 3:21 PMedwinn1337
08/14/2023, 5:49 PMedwinn1337
08/14/2023, 5:51 PMedwinn1337
08/14/2023, 5:52 PMporcellus
08/14/2023, 6:38 PMporcellus
08/14/2023, 6:38 PMedwinn1337
08/14/2023, 6:45 PMedwinn1337
08/14/2023, 6:47 PMedwinn1337
08/14/2023, 6:47 PMporcellus
08/14/2023, 7:22 PMproxy-agent
(or specifically it's dependency: agent-base
). A quick google search shows that this patches over the built-in http(s?) in a way that is not compatible with jose
.edwinn1337
08/14/2023, 7:25 PMedwinn1337
08/14/2023, 7:25 PMjs
"@sentry/node@7.54.0":
version "7.54.0"
resolved "https://registry.yarnpkg.com/@sentry/node/-/node-7.54.0.tgz#ebdc1f5d91e97bbfbbc70192bf2bf77433f5f55f"
integrity sha512-k8P7WD6lra3JF3H/y9GO+twBV8qQilj3X3d8PpaVPBHHwOA9AfdBVF18qgrdlZKghKtgALapZzrQQVnTOm34rw==
dependencies:
"@sentry-internal/tracing" "7.54.0"
"@sentry/core" "7.54.0"
"@sentry/types" "7.54.0"
"@sentry/utils" "7.54.0"
cookie "^0.4.1"
https-proxy-agent "^5.0.0"
lru_map "^0.3.3"
tslib "^1.9.3"
edwinn1337
08/14/2023, 7:28 PMjs
sentry: {
excludeServerRoutes: [
// Other routes you might want to exclude...
/^\/api\/auth\//,
],
},
im already excluding it from next.config, for all auth routes hmmporcellus
08/14/2023, 7:31 PMedwinn1337
08/14/2023, 7:36 PMedwinn1337
08/14/2023, 8:13 PMporcellus
08/14/2023, 8:49 PMsocks-proxy-agent
and proxy agent. maybe it is also added by something else in your deps? not sure.edwinn1337
08/15/2023, 7:16 AMedwinn1337
08/15/2023, 7:16 AMrp_st
08/15/2023, 7:17 AMrp_st
08/15/2023, 7:18 AMedwinn1337
08/15/2023, 7:18 AMjs
sentry: {
excludeServerRoutes: [
// Other routes you might want to exclude...
/^\/api\/auth\//,
],
},
so we opt-out from sentry on the auth server routesedwinn1337
08/15/2023, 7:22 AMjs
autoInstrumentServerFunctions: false,
optout for the auto instrumentation, just to confirm that its sentry which is causing the issuesporcellus
08/15/2023, 8:15 AMporcellus
08/15/2023, 8:16 AMedwinn1337
08/15/2023, 8:34 AMedwinn1337
08/15/2023, 8:55 AMporcellus
08/15/2023, 9:01 AMedwinn1337
08/15/2023, 9:20 AMporcellus
08/15/2023, 9:32 AM14.1.3
edwinn1337
08/15/2023, 9:32 AMedwinn1337
08/15/2023, 9:32 AMporcellus
08/15/2023, 9:32 AMedwinn1337
08/15/2023, 9:32 AMporcellus
08/15/2023, 9:33 AMedwinn1337
08/15/2023, 9:39 AMedwinn1337
08/15/2023, 9:40 AMporcellus
08/15/2023, 9:50 AMedwinn1337
08/15/2023, 9:50 AMporcellus
08/15/2023, 9:52 AMporcellus
08/15/2023, 9:52 AMporcellus
08/15/2023, 9:54 AMedwinn1337
08/15/2023, 9:57 AMedwinn1337
08/15/2023, 9:58 AMporcellus
08/15/2023, 10:06 AMedwinn1337
08/15/2023, 10:29 AMedwinn1337
08/15/2023, 10:50 AMedwinn1337
08/15/2023, 10:51 AMjs
integrations: [
// new Sentry.Replay({
// // Additional Replay configuration goes in here, for example:
// maskAllText: true,
// blockAllMedia: true,
// }),
],
we turned off Sentry.replay feature (which is not a bigdeal for us)edwinn1337
08/15/2023, 10:51 AMedwinn1337
08/15/2023, 10:51 AMporcellus
08/15/2023, 11:29 AMporcellus
08/15/2023, 11:30 AMedwinn1337
08/15/2023, 11:37 AMedwinn1337
08/15/2023, 11:38 AMedwinn1337
08/15/2023, 11:38 AMedwinn1337
08/15/2023, 11:38 AMrobschilder
08/15/2023, 11:40 AMedwinn1337
08/15/2023, 11:41 AMrp_st
08/15/2023, 11:44 AMrp_st
08/15/2023, 11:44 AMporcellus
08/15/2023, 11:48 AMedwinn1337
08/15/2023, 11:50 AMedwinn1337
08/15/2023, 11:50 AMedwinn1337
08/15/2023, 11:55 AMedwinn1337
08/15/2023, 11:56 AMedwinn1337
08/15/2023, 11:58 AMjs
export default async function superTokens(req: NextApiRequest & Request, res: NextApiResponse & Response) {
await authCors(req, res)
await superTokensNextWrapper(
async next => {
// This is needed for production deployments with Vercel
res.setHeader('Cache-Control', 'no-cache, no-store, max-age=0, must-revalidate')
await middleware()(req, res, next)
},
req,
res,
)
if (!res.writableEnded) {
res.status(404).send('Not found')
}
}
using this setHeader
the /knock endpoint doesnt
js
supertokens.init(backendConfig())
export default async function knock(req: SessionRequest, res: NextApiResponse & Response) {
// we first verify the session
await authCors(req, res)
await superTokensNextWrapper(async next => verifySession()(req, res, next), req, res)
if (!req.session) {
return res.status(401).json({ message: 'Unauthorized' })
}
could this be related?rp_st
08/15/2023, 11:59 AMrobschilder
08/15/2023, 12:00 PMyarn why jose
in our project I get:
=> Found "jwks-rsa#jose@2.0.6"
info This module exists because "_project_#dashboard-web#supertokens-node#jwks-rsa" depends on it.
It is weird because also in my reproduction you can see the jose with version 2.0.6
and it comes from Supertokens
- https://github.com/RobSchilderr/capacitor-supertokens-nextjs-turborepo/blob/main/yarn.lock
in this repo, when I run yarn why jose
I get:
=> Found "jwks-rsa#jose@2.0.6"
info This module exists because "_project_#jwks-rsa" depends on i
porcellus
08/15/2023, 12:02 PMsupertokens-node@13.6.0
in there as well as supertokens-node@14.1.2
robschilder
08/15/2023, 12:03 PMsupertokens-node@14.1.2
though, let me seerobschilder
08/15/2023, 12:08 PMsupertokens-node@13.6.0
and pushed it, it seems that the jose@2.0.6
is still in my `yarn.lock`:
=> Found "jwks-rsa#jose@2.0.6"
info This module exists because "_project_#next-web#supertokens-node#jwks-rsa" depends on it.
porcellus
08/15/2023, 12:14 PMjwks-rsa
dependency was only removed in 14.1.3
robschilder
08/15/2023, 12:15 PM14.1.3
could fix the issue?porcellus
08/15/2023, 12:16 PMporcellus
08/15/2023, 12:16 PMrobschilder
08/15/2023, 12:18 PMedwinn1337
08/15/2023, 12:57 PMedwinn1337
08/15/2023, 12:59 PMedwinn1337
08/15/2023, 1:37 PMrp_st
08/15/2023, 1:41 PMporcellus
08/15/2023, 1:42 PMporcellus
08/15/2023, 1:42 PMedwinn1337
08/15/2023, 1:47 PMedwinn1337
08/15/2023, 1:55 PMjs
shop-web:dev: 2023-08-15T13:54:15.064Z com.supertokens {t: "2023-08-15T13:54:15.064Z", message: "parseJWTWithoutSignatureVerification: version from header: 3", file: "C:\Projects\Lokalist\monorepo\node_modules\supertokens-node\lib\build\recipe\session\jwt.js:54:22" sdkVer: "14.1.3"}
shop-web:dev: Edwin TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received an instance of Object
shop-web:dev: at checkListener (node:events:266:3)
shop-web:dev: 2023-08-15T13:54:15.064Z com.supertokens {t: "2023-08-15T13:54:15.064Z", message: "getSession: got access token from header", file: "C:\Projects\Lokalist\monorepo\node_modules\supertokens-node\lib\build\recipe\session\sessionRequestFunctions.js:84:30" sdkVer: "14.1.3"}
at ClientRequest.once (node:events:647:3)
at new ClientRequest (node:_http_client:245:10)
at Object.request (node:https:360:10)
at Object.<anonymous> (C:\Projects\Lokalist\monorepo\node_modules\proxy-agent\node_modules\agent-base\patch-core.js:25:22)
at Object.request (C:\Projects\Lokalist\monorepo\node_modules\socks-proxy-agent\node_modules\agent-base\patch-core.js:23:20)shop-web:dev: at https.get (C:\Projects\Lokalist\monorepo\node_modules\socks-proxy-agent\node_modules\agent-base\patch-core.js:34:21)
at fetchJwks (C:\Projects\Lokalist\monorepo\node_modules\jose\dist\node\cjs\runtime\fetch_jwks.js:21:17)
2023-08-15T13:54:15.064Z com.supertokens {t: "2023-08-15T13:54:15.064Z", message: "getSession: using header transfer method", file: "C:\Projects\Lokalist\monorepo\node_modules\supertokens-node\lib\build\recipe\session\sessionRequestFunctions.js:104:22" sdkVer: "14.1.3"}shop-web:dev: 2023-08-15T13:54:15.064Z com.supertokens {t: "2023-08-15T13:54:15.064Z", message: "getSession: Value of doAntiCsrfCheck is: false", file: "C:\Projects\Lokalist\monorepo\node_modules\supertokens-node\lib\build\recipe\session\sessionRequestFunctions.js:144:18" sdkVer: "14.1.3"}
edwinn1337
08/15/2023, 1:56 PMedwinn1337
08/15/2023, 2:01 PMjs
=> Found "cloudinary#proxy-agent@5.0.0"
info This module exists because "_project_#business-web#cloudinary" depends on it.
info Disk size without dependencies: "52KB"
info Disk size with unique dependencies: "1.36MB"
info Disk size with transitive dependencies: "6.46MB"
info Number of shared dependencies: 54
Done in 0.72s.
its cloudinary who uses the proxy-agent,edwinn1337
08/15/2023, 2:01 PMporcellus
08/15/2023, 2:04 PMedwinn1337
08/15/2023, 2:07 PMedwinn1337
08/15/2023, 2:13 PMjs
"mailgun-js": "^0.22.0",
super old depedency, we could upgrade this one but can this be related?porcellus
08/15/2023, 2:14 PMedwinn1337
08/15/2023, 2:16 PMporcellus
08/15/2023, 2:16 PMedwinn1337
08/15/2023, 2:17 PMporcellus
08/15/2023, 2:18 PMedwinn1337
08/15/2023, 2:18 PMedwinn1337
08/15/2023, 2:18 PMporcellus
08/15/2023, 2:20 PMporcellus
08/15/2023, 2:20 PMedwinn1337
08/15/2023, 2:23 PMedwinn1337
08/15/2023, 2:25 PMrobschilder
08/15/2023, 3:27 PMedwinn1337
08/15/2023, 5:13 PMedwinn1337
08/15/2023, 5:13 PMrp_st
08/15/2023, 5:25 PMedwinn1337
08/15/2023, 5:31 PM