juspay/hyperswitch · error · Error

Business Profile Update Failed: ${response.body.error?.messa

Error message

Business Profile Update Failed: ${response.body.error?.message || response.status}

What it means

Thrown by the UpdateBusinessProfileTest command (cypress-tests/cypress/support/commands.js:1093) when POST {baseUrl}/account/{merchantId}/business_profile/{profileId} returns non-200. The message prefers response.body.error?.message and falls back to the bare numeric status when the body has no error object — a bare number usually means an HTML/gateway response (502/504), not a controlled API rejection.

Source

Thrown at cypress-tests/cypress/support/commands.js:1093

            ).to.have.property("authentication_connectors");
            globalState.set(
              "authConnectors",
              response.body.authentication_connector_details
                .authentication_connectors
            );
          }
          if (updateBusinessProfileBody.merchant_country_code) {
            expect(response.body.merchant_country_code).to.equal(
              updateBusinessProfileBody.merchant_country_code
            );
          }
          if (updateBusinessProfileBody.merchant_category_code) {
            expect(response.body.merchant_category_code).to.equal(
              updateBusinessProfileBody.merchant_category_code
            );
          }
        } else {
          throw new Error(
            `Business Profile Update Failed: ${response.body.error?.message || response.status}`
          );
        }
      });
    });
  }
);
Cypress.Commands.add("verifyUrlParamExcluded", (paramName, message) => {
  cy.url().then((url) => {
    const urlParams = new URLSearchParams(new URL(url).search);
    expect(urlParams.has(paramName), paramName).to.be.false;
    cy.task("cli_log", message);
  });
});

Cypress.Commands.add("verifyUrlParamIncluded", (paramName, message) => {
  cy.url().then((url) => {
    const urlParams = new URLSearchParams(new URL(url).search);

View on GitHub (pinned to 9b8b89dc37)

Solutions

  1. Check which form the message takes: an error string means a controlled API rejection, a bare number means infra/gateway failure
  2. Verify globalState.get(`${profilePrefix}Id`) is set and pass the SAME profilePrefix used at creation
  3. Validate merchant_country_code (ISO-3166 alpha-2) and merchant_category_code against the environment's accepted values
  4. Confirm the api-key is current and the merchant still exists
  5. For bare 502/504 statuses, retry against a healthy environment

Example fix

// before — profile created under a custom prefix but updated with the default (profileId undefined -> 404)
cy.createBusinessProfileTest(body, globalState, 'webhookConfigProfile');
cy.UpdateBusinessProfileTest(updateBody, a, b, c, d, globalState);
// after — keep the prefix consistent
cy.UpdateBusinessProfileTest(updateBody, a, b, c, d, globalState, 'webhookConfigProfile');
Defensive patterns

Strategy: try-catch

Validate before calling

const profileId = globalState.get(`${profilePrefix}Id`);
if (!profileId) {
  throw new Error(`No profile id under '${profilePrefix}Id' — create the profile with this prefix before updating`);
}

Try / catch

cy.on('fail', (err) => {
  if (err.message.includes('Business Profile Update Failed')) {
    // an error string means API rejection; a bare number means gateway/infra failure
    throw new Error(`Profile update rejected: ${err.message}`);
  }
  throw err;
});

Prevention

When it happens

Trigger: Updating with a profileId that is undefined in globalState (URL becomes .../business_profile/undefined and 404s) because profilePrefix doesn't match the create step; invalid merchant_country_code or merchant_category_code in updateBusinessProfileBody (400); expired api-key (401); gateway 502/504 where the body has no error.message so only the status prints.

Common situations: The profile was created under a namespaced prefix (e.g. 'webhookConfigProfile') but UpdateBusinessProfileTest was called with the default 'profile'; globalState reused from a previous run whose profile was deleted; MCC values the target environment rejects; running behind a flaky ingress.

Related errors


AI-assisted analysis of juspay/hyperswitch@9b8b89dc37 (2026-08-16). Data as JSON: /api/errors/a2a680a5910bcacf. Report an issue: GitHub.