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

add more log of utf8 failure #530

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
26 changes: 16 additions & 10 deletions apps/indexer-proxy/proxy/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ use subql_indexer_utils::{
};
use tower_http::cors::{Any, CorsLayer};

use crate::account::ACCOUNT;
use crate::ai::api_stream;
use crate::auth::{create_jwt, AuthQuery, AuthQueryLimit, Payload};
use crate::cli::COMMAND;
Expand Down Expand Up @@ -527,19 +528,24 @@ async fn ep_payg_handler(

let (body, mut headers) = match res_fmt.to_str() {
Ok("inline") => {
let return_body = if let Ok(return_data) = String::from_utf8(data.clone()) {
return_data
} else {
let unique_title = format!(
let return_body = match String::from_utf8(data.clone()) {
Ok(return_data) => return_data,
Err(err) => {
let account = ACCOUNT.read().await;
let indexer = account.indexer.clone();
drop(account);
let indexer_string = format!("{:?}", indexer);
let unique_title = format!(
"payg ep_query_handler, inline returns empty, deployment_id: {}, ep_name: {}",
deployment, ep_name
);
let msg = format!(
"res_fmt: {:#?}, headers: {:#?}, body: {}, data: {:?}",
res_fmt, headers, body, data
);
make_sentry_message(&unique_title, &msg);
"".to_owned()
let msg = format!(
"res_fmt: {:#?}, headers: {:#?}, body: {}, data: {:#?}, data length is {}, err is {:#?}, base64 data is {:#?}, account address is {:#?}",
res_fmt, headers, body, data, data.len(), err, general_purpose::STANDARD.encode(&data), indexer_string,
);
make_sentry_message(&unique_title, &msg);
"".to_owned()
}
};
(
return_body,
Expand Down
Loading