Merged in fix/improve-sas-error-logging (pull request #1854)
Improve SAS flow logging * Improve logging Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -73,10 +73,8 @@ export default function OneTimePasswordForm({
|
|||||||
|
|
||||||
switch (requestOtp.data?.status) {
|
switch (requestOtp.data?.status) {
|
||||||
case "ABUSED":
|
case "ABUSED":
|
||||||
router.push(`/${params.lang}/sas-x-scandic/error?errorCode=tooManyCodes`)
|
|
||||||
return <Loading />
|
|
||||||
case "NOTSENT":
|
case "NOTSENT":
|
||||||
router.push(`/${params.lang}/sas-x-scandic/error`)
|
router.push(`/${params.lang}/sas-x-scandic/error?errorCode=tooManyCodes`)
|
||||||
return <Loading />
|
return <Loading />
|
||||||
case "NULL":
|
case "NULL":
|
||||||
case "RETRY":
|
case "RETRY":
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as Sentry from "@sentry/nextjs"
|
||||||
import { z } from "zod"
|
import { z } from "zod"
|
||||||
|
|
||||||
import * as api from "@/lib/api"
|
import * as api from "@/lib/api"
|
||||||
@@ -59,9 +60,9 @@ export const linkAccount = protectedProcedure
|
|||||||
return { linkingState: "alreadyLinked" }
|
return { linkingState: "alreadyLinked" }
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(
|
const errorMessage = `[SAS] link account error with status code ${apiResponse.status} and response ${await apiResponse.text()}`
|
||||||
`[SAS] link account error with status code ${apiResponse.status} and response ${await apiResponse.text()}`
|
console.warn(errorMessage)
|
||||||
)
|
Sentry.captureMessage(errorMessage)
|
||||||
return { linkingState: "error" }
|
return { linkingState: "error" }
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import * as Sentry from "@sentry/nextjs"
|
||||||
import { TRPCError } from "@trpc/server"
|
import { TRPCError } from "@trpc/server"
|
||||||
import { cookies } from "next/headers"
|
import { cookies } from "next/headers"
|
||||||
import { v4 as uuidv4 } from "uuid"
|
import { v4 as uuidv4 } from "uuid"
|
||||||
@@ -43,7 +44,6 @@ export const requestOtp = protectedProcedure
|
|||||||
const sasAuthToken = getSasToken()
|
const sasAuthToken = getSasToken()
|
||||||
|
|
||||||
if (!sasAuthToken) {
|
if (!sasAuthToken) {
|
||||||
// TODO: Should we verify that the SAS token isn't expired?
|
|
||||||
throw createError("AUTH_TOKEN_NOT_FOUND")
|
throw createError("AUTH_TOKEN_NOT_FOUND")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,6 +67,10 @@ export const requestOtp = protectedProcedure
|
|||||||
|
|
||||||
if (parseResult.data.status === "SENT") {
|
if (parseResult.data.status === "SENT") {
|
||||||
setSASOtpCookie(parseResult.data)
|
setSASOtpCookie(parseResult.data)
|
||||||
|
} else {
|
||||||
|
const sasRequestOtpErrorMessage = `[SAS] requestOtp did not return SENT status with body: ${body}`
|
||||||
|
console.warn(sasRequestOtpErrorMessage)
|
||||||
|
Sentry.captureMessage(sasRequestOtpErrorMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
return parseResult.data
|
return parseResult.data
|
||||||
|
|||||||
@@ -71,13 +71,13 @@ export const performLevelUpgrade = protectedProcedure
|
|||||||
if (notLinked) {
|
if (notLinked) {
|
||||||
const tierMatchErrorNotLinkedMessage =
|
const tierMatchErrorNotLinkedMessage =
|
||||||
"[SAS] tier match error - not linked"
|
"[SAS] tier match error - not linked"
|
||||||
console.log(tierMatchErrorNotLinkedMessage)
|
console.warn(tierMatchErrorNotLinkedMessage)
|
||||||
Sentry.captureMessage(tierMatchErrorNotLinkedMessage)
|
Sentry.captureMessage(tierMatchErrorNotLinkedMessage)
|
||||||
return { tierMatchState: "notLinked" }
|
return { tierMatchState: "notLinked" }
|
||||||
}
|
}
|
||||||
|
|
||||||
const tierMatchErrorMessage = `[SAS] tier match error with status code ${apiResponse.status} and response ${await apiResponse.text()}`
|
const tierMatchErrorMessage = `[SAS] tier match error with status code ${apiResponse.status} and response ${await apiResponse.text()}`
|
||||||
console.log(tierMatchErrorMessage)
|
console.error(tierMatchErrorMessage)
|
||||||
Sentry.captureException(new Error(tierMatchErrorMessage))
|
Sentry.captureException(new Error(tierMatchErrorMessage))
|
||||||
return { tierMatchState: "error" }
|
return { tierMatchState: "error" }
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user