You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have code that works in stripe test mode but causes a panic when switching to live mode. This is a basic implementation of a checkout session largely transcribed from stripe's other examples for embedded checkout code.
Update: I discovered the problem to be a newline character getting into my API key from the environment due to the way my production server loads its secrets.
thread 'tokio-runtime-worker' panicked at /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/http-types-2.12.0/src/hyperium_http.rs:162:71:
called `Result::unwrap()` on an `Err` value: InvalidHeaderValue
stack backtrace:
0: rust_begin_unwind
1: core::panicking::panic_fmt
2: core::result::unwrap_failed
3: http_types::hyperium_http::headers_to_hyperium_headers
4: http_types::hyperium_http::<impl core::convert::From<http_types::request::Request> for http::request::Request<http_types::body::Body>>::from
5: stripe::client::base::tokio::send_inner::{{closure}}
6: stripe::client::base::tokio::TokioClient::execute::{{closure}}
I looked into http_types and it seems to be blindly doing an unwrap in this function, likely invoked by an into within send_inner
I figured out my issue, it was related to the configuration of my prod environment. A new line character was sneaking in to the environment variable holding my API key and that's what caused the panic.
I think this is still worth fixing with some checks or coercion, but feel free to close if you don't agree after you see this.
Describe the bug
I have code that works in stripe test mode but causes a panic when switching to live mode. This is a basic implementation of a checkout session largely transcribed from stripe's other examples for embedded checkout code.
Update: I discovered the problem to be a newline character getting into my API key from the environment due to the way my production server loads its secrets.
I looked into http_types and it seems to be blindly doing an
unwrap
in this function, likely invoked by aninto
withinsend_inner
To Reproduce
Expected behavior
Should not panic
Code snippets
OS
linux
Rust version
1.79
Library version
0.37.1
API version
2024-04-10
Additional context
This is happening before I get a tick in the 'api calls' section of Stripe.
The text was updated successfully, but these errors were encountered: