GoogleCloudPlatform/microservices-demo · error
failed to complete the order
Error message
failed to complete the order
What it means
Wraps the gRPC error returned by the CheckoutService PlaceOrder RPC. It fires when the checkout backend is unreachable, times out, or rejects the order (invalid card details, unsupported currency, or a downstream failure in payment/cart/currency services).
Source
Thrown at src/frontend/handlers.go:372
order, err := pb.NewCheckoutServiceClient(fe.checkoutSvcConn).
PlaceOrder(r.Context(), &pb.PlaceOrderRequest{
Email: payload.Email,
CreditCard: &pb.CreditCardInfo{
CreditCardNumber: payload.CcNumber,
CreditCardExpirationMonth: int32(payload.CcMonth),
CreditCardExpirationYear: int32(payload.CcYear),
CreditCardCvv: int32(payload.CcCVV)},
UserId: sessionID(r),
UserCurrency: currentCurrency(r),
Address: &pb.Address{
StreetAddress: payload.StreetAddress,
City: payload.City,
State: payload.State,
ZipCode: int32(payload.ZipCode),
Country: payload.Country},
})
if err != nil {
renderHTTPError(log, r, w, errors.Wrap(err, "failed to complete the order"), http.StatusInternalServerError)
return
}
log.WithField("order", order.GetOrder().GetOrderId()).Info("order placed")
order.GetOrder().GetItems()
recommendations, _ := fe.getRecommendations(r.Context(), sessionID(r), nil)
totalPaid := *order.GetOrder().GetShippingCost()
for _, v := range order.GetOrder().GetItems() {
multPrice := money.MultiplySlow(*v.GetCost(), uint32(v.GetItem().GetQuantity()))
totalPaid = money.Must(money.Sum(totalPaid, multPrice))
}
currencies, err := fe.getCurrencies(r.Context())
if err != nil {
renderHTTPError(log, r, w, errors.Wrap(err, "could not retrieve currencies"), http.StatusInternalServerError)
return
}View on GitHub (pinned to 72ba613a05)
Solutions
- Check connectivity and health of the checkout service from the frontend.
- Inspect the wrapped gRPC status code to distinguish transport failure from order rejection (invalid credit card or address).
- Validate the submitted form fields (email, card number, expiry, CVV, address) before calling PlaceOrder.
- Retry transient UNAVAILABLE/DEADLINE_EXCEEDED failures with backoff; surface a user-friendly checkout error otherwise.
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at src/frontend/handlers.go:372 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of GoogleCloudPlatform/microservices-demo@72ba613a05 (2026-09-02).
Data as JSON: /api/errors/5f9c232b3229e435.
Report an issue: GitHub.