Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: more debugging for transient_payload #3255

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,4 @@ junit.xml
.next

.direnv
.env.local
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { RegistrationPayloadValidator } from "@domain/authentication/registratio
import { ErrorLevel } from "@domain/shared"
import { InvalidPhoneNumber, InvalidUserId } from "@domain/errors"

import { recordExceptionInCurrentSpan } from "@services/tracing"
import {
addAttributesToCurrentSpan,
recordExceptionInCurrentSpan,
} from "@services/tracing"
import { SchemaIdType } from "@services/kratos"

import { createAccountWithPhoneIdentifier } from "@app/accounts"
Expand All @@ -21,6 +24,10 @@ export const createAccountFromRegistrationPayload = async ({
schema_id?: string
}
}): Promise<Account | ApplicationError> => {
addAttributesToCurrentSpan({
"registration.body": JSON.stringify(body),
})

const isValidKey = CallbackSecretValidator(KRATOS_CALLBACK_API_KEY).authorize(secret)
if (isValidKey instanceof Error) {
return isValidKey
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GT } from "@graphql/index"

import AccountUpdateNotificationSettingsPayload from "@graphql/public/types/payload/account-update-notification-settings"
import { Accounts } from "@app/index"
import { Accounts } from "@app"
import { mapAndParseErrorForGqlResponse } from "@graphql/error-map"
import NotificationChannel from "@graphql/shared/types/scalar/notification-channel"
import NotificationCategory from "@graphql/shared/types/scalar/notification-category"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GT } from "@graphql/index"

import AccountUpdateNotificationSettingsPayload from "@graphql/public/types/payload/account-update-notification-settings"
import { Accounts } from "@app/index"
import { Accounts } from "@app"
import { mapAndParseErrorForGqlResponse } from "@graphql/error-map"
import NotificationChannel from "@graphql/shared/types/scalar/notification-channel"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GT } from "@graphql/index"

import AccountUpdateNotificationSettingsPayload from "@graphql/public/types/payload/account-update-notification-settings"
import { Accounts } from "@app/index"
import { Accounts } from "@app"
import { mapAndParseErrorForGqlResponse } from "@graphql/error-map"
import NotificationChannel from "@graphql/shared/types/scalar/notification-channel"
import NotificationCategory from "@graphql/shared/types/scalar/notification-category"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GT } from "@graphql/index"

import AccountUpdateNotificationSettingsPayload from "@graphql/public/types/payload/account-update-notification-settings"
import { Accounts } from "@app/index"
import { Accounts } from "@app"
import { mapAndParseErrorForGqlResponse } from "@graphql/error-map"
import NotificationChannel from "@graphql/shared/types/scalar/notification-channel"

Expand Down
13 changes: 7 additions & 6 deletions src/servers/event-handlers/kratos.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import cors from "cors"
import express from "express"

import { addAttributesToCurrentSpan, wrapAsyncToRunInSpan } from "@services/tracing"
import { wrapAsyncToRunInSpan } from "@services/tracing"
import { baseLogger } from "@services/logger"

import { createAccountFromRegistrationPayload } from "@app/authentication"
import { Authentication } from "@app"

import {
SecretForAuthNCallbackError,
RegistrationPayloadValidationError,
Expand All @@ -31,11 +32,11 @@ kratosCallback.post(
fn: async (req: express.Request, res: express.Response) => {
const secret = req.headers.authorization
const body = req.body
addAttributesToCurrentSpan({
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for some reasons, this span does show up

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe because addAttributesToCurrentSpan inside wrapAsyncToRunInSpan ? haven't tried to debug it too much

"registration.body": JSON.stringify(body),
})

const account = await createAccountFromRegistrationPayload({ secret, body })
const account = await Authentication.createAccountFromRegistrationPayload({
secret,
body,
})
if (account instanceof Error) {
const message = errorResponseMessages[account.name] || "unknown error"
switch (true) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Wallets } from "@app/index"
import { Wallets } from "@app"

import { ZERO_SATS } from "@domain/shared"
import { MultipleCurrenciesForSingleCurrencyOperationError } from "@domain/errors"
Expand Down
Loading