debug: debug profile calls
This commit is contained in:
@@ -90,7 +90,7 @@ async function getVerifiedUser({ session }: { session: Session }) {
|
||||
return { error: true, cause: "token_expired" } as const
|
||||
}
|
||||
getVerifiedUserCounter.add(1)
|
||||
console.info("api.user.profile start", JSON.stringify({}))
|
||||
console.info("api.user.profile getVerifiedUser start", JSON.stringify({}))
|
||||
const apiResponse = await api.get(api.endpoints.v1.profile, {
|
||||
cache: "no-store",
|
||||
headers: {
|
||||
@@ -109,9 +109,10 @@ async function getVerifiedUser({ session }: { session: Session }) {
|
||||
}),
|
||||
})
|
||||
console.error(
|
||||
"api.user.profile error",
|
||||
"api.user.profile getVerifiedUser error",
|
||||
JSON.stringify({
|
||||
error: {
|
||||
token: session.token.access_token,
|
||||
status: apiResponse.status,
|
||||
statusText: apiResponse.statusText,
|
||||
text,
|
||||
@@ -135,7 +136,10 @@ async function getVerifiedUser({ session }: { session: Session }) {
|
||||
const apiJson = await apiResponse.json()
|
||||
if (!apiJson.data?.attributes) {
|
||||
getVerifiedUserFailCounter.add(1, { error_type: "data_error" })
|
||||
console.error("api.user.profile data error", JSON.stringify({})) // not passing the data to avoid logging sensitive data
|
||||
console.error(
|
||||
"api.user.profile getVerifiedUser data error",
|
||||
JSON.stringify({})
|
||||
) // not passing the data to avoid logging sensitive data
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -154,7 +158,7 @@ async function getVerifiedUser({ session }: { session: Session }) {
|
||||
return null
|
||||
}
|
||||
getVerifiedUserSuccessCounter.add(1)
|
||||
console.info("api.user.profile success", JSON.stringify({}))
|
||||
console.info("api.user.profile getVerifiedUser success", JSON.stringify({}))
|
||||
return verifiedData
|
||||
}
|
||||
|
||||
@@ -185,7 +189,7 @@ async function updateStaysBookingUrl(
|
||||
) {
|
||||
// Tenporary API call needed till we have user name in ctx session data
|
||||
getProfileCounter.add(1)
|
||||
console.info("api.user.profile start", JSON.stringify({}))
|
||||
console.info("api.user.profile updatebookingurl start", JSON.stringify({}))
|
||||
const apiResponse = await api.get(api.endpoints.v1.profile, {
|
||||
cache: "no-store",
|
||||
headers: {
|
||||
@@ -223,7 +227,10 @@ async function updateStaysBookingUrl(
|
||||
|
||||
if (apiResponse.ok) {
|
||||
getProfileSuccessCounter.add(1)
|
||||
console.info("api.user.profile success", JSON.stringify({}))
|
||||
console.info(
|
||||
"api.user.profile updatebookingurl success",
|
||||
JSON.stringify({})
|
||||
)
|
||||
const apiJson = await apiResponse.json()
|
||||
if (apiJson.data?.attributes) {
|
||||
return data.map((d) => {
|
||||
@@ -250,7 +257,10 @@ async function updateStaysBookingUrl(
|
||||
}
|
||||
}
|
||||
getProfileFailCounter.add(1, { error: JSON.stringify(apiResponse) })
|
||||
console.info("api.user.profile error", JSON.stringify({ error: apiResponse }))
|
||||
console.info(
|
||||
"api.user.profile updatebookingurl error",
|
||||
JSON.stringify({ error: apiResponse })
|
||||
)
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user