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

Fxa fixes #321

Merged
merged 6 commits into from
Jul 13, 2022
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
183 changes: 152 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions autoendpoint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ a2 = { git = "https://github.com/mozilla-services/a2.git", branch = "autoendpoin
actix-web = "3.3"
actix-rt = "1.1" # 2.0+ requires futures 0.3+
actix-cors = "0.5"
actix-http = "3.0"
again = { version = "0.1.2", default-features = false, features = ["log", "rand"] }
async-trait = "0.1"
autopush_common = { path = "../autopush-common" }
Expand Down
6 changes: 6 additions & 0 deletions autoendpoint/src/db/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ impl DbClientImpl {
router_table: String,
message_table: String,
) -> DbResult<Self> {
debug!("Tables: {} and {}", router_table, message_table);
let ddb = if let Ok(endpoint) = env::var("AWS_LOCAL_DYNAMODB") {
DynamoDbClient::new_with(
HttpClient::new().expect("TLS initialization error"),
Expand Down Expand Up @@ -205,6 +206,11 @@ impl DbClient for DbClientImpl {
}

async fn get_user(&self, uaid: Uuid) -> DbResult<Option<DynamoDbUser>> {
trace!(
"Looking up user: {:?} in {}",
uaid.as_simple().to_string(),
self.router_table.clone()
);
let input = GetItemInput {
table_name: self.router_table.clone(),
consistent_read: Some(true),
Expand Down
5 changes: 4 additions & 1 deletion autoendpoint/src/extractors/notification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ impl FromRequest for Notification {
// Read data
let data = web::Bytes::from_request(&req, &mut payload)
.await
.map_err(ApiErrorKind::PayloadError)?;
.map_err(|e| {
debug!("▶▶ Request read payload error: {:?}", &e);
ApiErrorKind::PayloadError(e)
})?;

// Convert data to base64
let data = if data.is_empty() {
Expand Down
7 changes: 5 additions & 2 deletions autoendpoint/src/extractors/notification_headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,15 @@ mod tests {
fn valid_topic() {
let req = TestRequest::post()
.header("TTL", "10")
.header("TOPIC", "test-topic")
.header("TOPIC", "a-test-topic-which-is-just-right")
.to_http_request();
let result = NotificationHeaders::from_request(&req, false);

assert!(result.is_ok());
assert_eq!(result.unwrap().topic, Some("test-topic".to_string()));
assert_eq!(
result.unwrap().topic,
Some("a-test-topic-which-is-just-right".to_string())
);
}

/// Topic names which are too long return an error
Expand Down
Loading