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