Skip to content

Commit 65a439e

Browse files
authored
fix: cannot send event error (#55)
* rust tls certificates * bump version * error -> warn for protocol deeplinks * bump version * setup user scope
1 parent 4f36549 commit 65a439e

File tree

11 files changed

+53
-140
lines changed

11 files changed

+53
-140
lines changed

core/Cargo.lock

Lines changed: 7 additions & 60 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "dcl-launcher-core"
3-
version = "1.0.14"
3+
version = "1.0.16"
44
edition = "2024"
55

66
[lib]
@@ -28,7 +28,7 @@ plist = "=1.7.0"
2828

2929
serde = { version = "1", features = ["derive"] }
3030
serde_json = "1"
31-
reqwest = { version = "0.12", features = ["json", "stream"] }
31+
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls", "stream"] }
3232
regex = "1.11.1"
3333
anyhow = "1.0.97"
3434

@@ -47,12 +47,12 @@ fern = "0.7.1"
4747
pretty_env_logger = "0.5.0"
4848
humantime = "2.2.0"
4949

50-
segment = "0.2.6"
50+
segment = { version = "0.2.6", default-features = false, features = ["rustls-tls"] }
5151
uuid = { version = "1.16.0", features = ["v4"] }
5252

5353
nix = { version = "0.29.0", features = ["process"] }
5454

55-
sentry = { version = "0.37.0", features = ["anyhow", "log", "reqwest", "backtrace"] }
55+
sentry = { version = "0.37.0", features = ["anyhow", "log", "reqwest", "rustls", "backtrace"] }
5656
sentry-anyhow = { version = "0.37.0" }
5757
sentry-log = "0.37.0"
5858
sentry-types = "0.37.0"

core/src/analytics.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@ impl Analytics {
4141
info!(
4242
"SEGMENT_API_KEY is set successfully from environment variable, segment is available"
4343
);
44-
let anonymous_id = config::user_id().unwrap_or_else(|e| {
45-
error!("Cannot get user id from config, fallback is used: {:#}", e);
46-
"none".to_owned()
47-
});
44+
let anonymous_id = config::user_id_or_none();
4845
let launcher_version = app_version().to_owned();
4946
let os = get_os_name().to_owned();
5047
let args = CreateArgs {

core/src/config.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use anyhow::{Context, Result, anyhow};
2+
use log::error;
23
use serde_json::{Map, Value};
34

45
use crate::installs::config_path;
@@ -21,7 +22,7 @@ fn write_config(value: Map<String, Value>) -> Result<()> {
2122
Ok(())
2223
}
2324

24-
pub fn user_id() -> Result<String> {
25+
fn user_id() -> Result<String> {
2526
const KEY: &str = "analytics-user-id";
2627
let config = config_content()?;
2728
if let Some(id) = config.get(KEY) {
@@ -42,3 +43,10 @@ pub fn user_id() -> Result<String> {
4243
write_config(config)?;
4344
Ok(id)
4445
}
46+
47+
pub fn user_id_or_none() -> String {
48+
user_id().unwrap_or_else(|e| {
49+
error!("Cannot get user id from config, fallback is used: {:#}", e);
50+
"none".to_owned()
51+
})
52+
}

core/src/monitoring.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ use std::str::FromStr;
33
use anyhow::Result;
44
use log::{error, info};
55

6-
use sentry::ClientOptions;
6+
use sentry::{ClientOptions, protocol::User};
77
use sentry_types::Dsn;
88

9+
use crate::config;
10+
911
pub struct Monitoring {}
1012

1113
impl Monitoring {
@@ -35,6 +37,18 @@ impl Monitoring {
3537
// keeps guard for the whole lifetime of the app
3638
std::mem::forget(guard);
3739
info!("sentry dns initialized successfully");
40+
41+
// Set user scope
42+
let user_id = config::user_id_or_none();
43+
info!("sentry user_id {}", user_id);
44+
45+
sentry::configure_scope(|scope| {
46+
scope.set_user(Some(User {
47+
id: Some(user_id),
48+
..Default::default()
49+
}));
50+
});
51+
3852
Ok(())
3953
}
4054
}

core/src/protocols.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::sync::Mutex;
22

3-
use log::error;
3+
use log::{error, warn};
44

55
static PROTOCOL_STATE: Mutex<Option<String>> = Mutex::new(None);
66
const PROTOCOL_PREFIX: &str = "decentraland://";
@@ -48,7 +48,7 @@ impl Protocol {
4848
}
4949
}
5050

51-
error!(
51+
warn!(
5252
"none of values starts with prefix protocol {}: {:?}",
5353
PROTOCOL_PREFIX, value
5454
);

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Decentraland",
33
"private": true,
4-
"version": "1.0.14",
4+
"version": "1.0.16",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
@@ -33,4 +33,4 @@
3333
"typescript": "~5.6.2",
3434
"vite": "^6.0.3"
3535
}
36-
}
36+
}

0 commit comments

Comments
 (0)