Hidden Assumptions in hyperswitch-prism

10 assumptions this code never checks · 2 critical · spanning Environment, Domain, Contract, Temporal, Scale, Ordering

Every codebase relies on things it never checks. Most of them are routine. CodeSea looked at juspay/hyperswitch-prism and picked out the few most likely to cause trouble — explained plainly, with what to do about each. The full list is just below.

Most of what this code assumes is routine. These 2 are the ones most likely to cause trouble here — in plain terms, with what to do about each. The rest are minor; they're under "Show everything".

Worth your attention first

The system needs a file containing secret API keys for every payment processor. It figures out where that file is from an environment variable you have to set yourself. If you forget to set that variable, set it to the wrong path, or use a file that's missing keys for the processor you're trying to use, the system quietly tries to connect anyway — with blank or missing credentials. The processor rejects it with a confusing error that doesn't say 'your key file is wrong or missing.'

What to do: Before your first real run, double-check that the environment variable pointing to your credentials file is set correctly and that the file actually contains entries for every processor you intend to use.

Worth your attention first

Different currencies work differently: Japanese Yen has no decimal places, Bahraini Dinar has three, most others have two. Each payment processor integration has to know this and convert accordingly. The system has types that help, but there is no automatic check that the conversion was written correctly for every currency a connector might receive. If it's wrong, a charge could go through at 100 times too little or some other wrong amount — and everything looks fine in the logs because the system just echoes back what you originally sent.

What to do: When adding a new processor or testing an existing one with an unusual currency (especially zero-decimal ones like JPY or three-decimal ones like BHD and KWD), run a small test transaction and verify the settled amount in the processor's own dashboard, not just in the API response.

Show everything (8 more)
Contract

When an automation step is told to wait for both a page element and a URL change at the same time, both waits share the same countdown clock. If one of them takes a long time, there may not be enough time left for the other one to complete, causing the whole step to fail even though the page was perfectly fine — just slow.

What to do: If you see flaky failures on steps that wait for two things at once, split them into two separate steps, each with its own timeout, so slowness in one doesn't kill the other.

browser-automation-engine/src/engine/interpreter.ts:executeRule (waitFor case)
Temporal

The Google Pay flow uses a saved login session so you don't have to sign in every time. Google expires these sessions after weeks or months without warning. When that happens, the tool just hangs waiting for a page element that will never appear, then fails with a timeout — giving no hint that you simply need to log in again.

What to do: If Google Pay token generation starts timing out unexpectedly, run the one-time login step again to refresh the saved session before investigating anything else.

browser-automation-engine/src/gpay-token-gen.ts:gpay-token-gen
Environment

The browser automation service needs a full copy of the Chrome browser installed in exactly the right place on the machine. The server starts up and says it's ready even if Chrome isn't there. The error only appears when the first actual job comes in, making it look like a request problem rather than a setup problem.

What to do: After deploying the browser automation service to any new machine or container, send one test request immediately at startup to confirm Chrome is installed and working before relying on it for real jobs.

browser-automation-engine/src/drivers/playwrightDriver.ts:PlaywrightDriverFactory
Scale

Every time someone sends a job to the browser automation service, it starts a brand-new copy of Chrome just for that job and never reuses old ones. If many jobs arrive at once, you end up running many copies of Chrome simultaneously. Each copy uses hundreds of megabytes of memory, and there's no limit — the machine can simply run out of memory and crash.

What to do: If you expect more than a handful of simultaneous requests, put a concurrency limit (a queue or semaphore) in front of the browser engine so it only runs as many Chrome sessions as the host machine can comfortably support.

browser-automation-engine/src/engine/automationEngine.ts:AutomationEngine.run
Ordering

Automation scripts can save a value from one step (like a confirmation code) and use it in a later step. But there's no check that the step which saves the value actually runs before the step that tries to use it. If someone writes the steps in the wrong order, the later step gets an empty value or crashes — with an error message that doesn't explain the ordering problem.

What to do: When writing automation scripts that pass data between steps, always put the step that captures the value before any step that uses it, and test the script end-to-end at least once to catch ordering mistakes.

browser-automation-engine/src/engine/interpreter.ts:executeRule (extract case)
Domain

Some older payment processors send their responses in a text format that starts with a special marker in an older encoding. The system knows how to handle one kind of marker but not others. If a processor uses the older style, the response will fail to parse with an error message about bad data rather than 'wrong text encoding.'

What to do: If you add a legacy or XML-based processor and see mysterious parsing failures on otherwise valid-looking responses, check whether the processor is sending its data in an encoding other than UTF-8.

crates/common/common_utils/src/bytes_utils.rs:strip_utf8_bom
Contract

When a payment processor's firewall or content-delivery network blocks a request, it often replies with a web page saying 'access denied' instead of the expected payment response — but still uses the same HTTP success code. The system tries to interpret that web page as a payment response, fails, and tells you 'parsing failed' with no hint that the processor never even saw the request.

What to do: If you see repeated parsing errors that aren't obviously malformed data, log the raw response body temporarily to check whether you're receiving an HTML page rather than a real processor response.

crates/grpc-server/grpc-server:gRPC handler / connector-integration trait
Environment

The AI tool that writes new payment processor integrations for you assumes the AI service it uses is online, that the specific AI model it asks for still exists, and that your account can handle very large requests. None of this is checked before the job starts. If any of those things are wrong, you may wait a long time before getting an error, and any partial code that was generated might be written to disk in an incomplete state.

What to do: Before running the AI code-generation tool for the first time, verify your API key works and that the configured model name is correct by sending a small test request to the provider.

grace/src/types/config.py:LlmConfig

See the full structural analysis of hyperswitch-prism: the pipeline, data models, and system behavior that put these assumptions in context.

Full analysis of juspay/hyperswitch-prism →

Frequently Asked Questions

What does hyperswitch-prism assume that could break in production?

The one most likely to cause trouble: The system needs a file containing secret API keys for every payment processor. It figures out where that file is from an environment variable you have to set yourself. If you forget to set that variable, set it to the wrong path, or use a file that's missing keys for the processor you're trying to use, the system quietly tries to connect anyway — with blank or missing credentials. The processor rejects it with a confusing error that doesn't say 'your key file is wrong or missing.' What to do: Before your first real run, double-check that the environment variable pointing to your credentials file is set correctly and that the file actually contains entries for every processor you intend to use.

How many hidden assumptions does hyperswitch-prism have?

CodeSea found 10 assumptions hyperswitch-prism relies on but never validates, 2 of them critical, spanning Environment, Domain, Contract, Temporal, Scale, Ordering. Most are routine — the analysis flags the two or three most likely to actually bite.

What is a hidden assumption?

Something the code depends on but never checks: a data shape, an ordering, an environment condition, a scale limit, or a contract with another service. It holds until the world it runs in changes, then fails silently.