Skip to content
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
5 changes: 0 additions & 5 deletions .changeset/clear-order-status-errors.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/free-shipping-default-selection.md

This file was deleted.

16 changes: 0 additions & 16 deletions .changeset/quiet-route-failures.md

This file was deleted.

18 changes: 18 additions & 0 deletions packages/commerce-server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# @godaddy/gd-commerce-server

## 0.3.0

### Minor Changes

- b39d49d: Return 400 from the order-status route for invalid order IDs, including IDs the Orders API rejects as malformed, and 404 when the Orders API reports the order missing or it belongs to another store or channel, instead of 500. A 404 without the Orders API's `NOT_FOUND` code, such as from a misconfigured base URL, stays a logged 500. The 500 response no longer includes the internal error message; it is logged server-side instead. Export `InvalidOrderIdError`, `OrderNotFoundError`, and `ORDER_STATUS_UNKNOWN` for in-process `getOrderStatus()` callers; check `error.name` rather than `instanceof` so the check holds when a host has more than one copy of this package.
- 9a172d8: Standardize route error handling. Every failure now responds with `{ error, code, requestId }` and no longer includes internal error text in a `message` field.

Status codes now reflect the cause:

- 502 for Commerce failures, including rejected OAuth credentials (`upstream_unauthorized`); previously 500. This includes order-status upstream failures, which were 500. An OAuth 400 is `upstream_unauthorized` only for `invalid_client`, `invalid_grant`, `unauthorized_client`, or `invalid_scope`.
- 503 for missing or unreadable configuration on every route; previously 500 everywhere except `/config`. Data and checkout routes also return 503 `not_configured` when the host reports a connection state other than `ready`; previously 500.
- 404 for writes to an existing cart (`/cart/:id/...`) that is missing, expired, or completed; previously 500. Creating a cart and checkout are not classified this way and return 502.
- 500 only for unexpected errors.

Hosts can pass `logger` and `getRequestId` to the router factories to receive failure detail and reuse their own request ids; a throwing `getRequestId` falls back to a generated id. In-process helpers, including `getOrderStatus()` and `createCheckoutSession()`, throw exported `CommerceError` subclasses, also when a host configuration throws while being read. Check `error.code` rather than `instanceof` or `error.name`; it holds when a host has more than one copy of this package. `validateCommerceCartScope` was internal and is replaced by a throwing `assertCommerceCartScope`.

Hosts that read `message` or check for status 500 should switch to `code` and server-side logs.

## 0.2.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/commerce-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@godaddy/gd-commerce-server",
"version": "0.2.0",
"version": "0.3.0",
"description": "Opinionated Express server integration for GoDaddy Commerce",
"type": "module",
"license": "MIT",
Expand Down
6 changes: 6 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @godaddy/react

## 1.0.59

### Patch Changes

- c564b12: Select a free shipping rate by default when one is available, even if a paid rate was already applied automatically or is already on the draft order. A rate the shopper picks is kept until the page is reloaded or the shopper switches to local pickup.

## 1.0.58

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@godaddy/react",
"private": false,
"version": "1.0.58",
"version": "1.0.59",
"type": "module",
"types": "./dist/index.d.ts",
"files": [
Expand Down