Staging is down: how to keep building your app
Staging was taken down for an update, and the screen you’re finishing shows “No connection”. An hour goes to waiting. If the API responses were recorded in advance, Microkoi Bench returns them instead of the server with one click. The app isn’t rebuilt and calls the same addresses.
Why a staging outage stops your work
Staging is shared. It gets updated, its database gets migrated, other people’s tests load it. Each such hour doesn’t stop the whole day, just its most valuable part: checking what you’ve just written.
A stub in the code won’t save the hour: you have to write it and then remove it. And it bypasses the network layer, so response parsing and errors go untested.
While staging works, record the responses
Start the proxy and go through the screens you’re working on in the app: open lists and details, submit a form. Bench records each exchange in full and sorts the requests by host and path in the “Endpoints” tree on the Traffic screen.
- Hover over the
api.example.comhost in the “Endpoints” tree. - Click “Create mocks for all requests in group”. Each method and path pair becomes a mock with the last recorded response.
- A summary appears above the table, for example “Created 12 mocks”. Mocks are created turned off: while staging works, staging answers.
If different requests went to the same address, for example the steps of a sign-up, Bench creates a mock with a condition for each variant. Clicking again doesn’t create duplicates, it only adds new addresses. Refresh the recording when the screen starts calling new endpoints.
Staging went down: one click
Open the “Mocks” section and click “Enable all mocks inside” on the api.example.com host. The app keeps calling its addresses, and Bench answers with the recorded staging responses. No need to change the API address in the build.
In “Traffic”, such exchanges have a blue mock cube in the first column. An exchange without the cube went to the server: no mock matched that request.
Mocks answer only requests that go through the running Bench proxy, and only for hosts recorded in the workspace. If the proxy is stopped or the host isn’t recorded, the mock editor warns you with a bar above the fields.
What the recording doesn’t have
- Requests you didn’t make while recording. They go to the server and come back with an error: that’s your list of what to record next time.
- State. A submitted form always gets the recorded response, and the list after it doesn’t change.
- A slow network. The response arrives immediately unless you fill in the mock’s “Delay” field.
An empty list, a 500 or a 401 can be set in the same mocks: edit the body or the status code. A recorded response is a good starting point for such edits.
Know when staging is back
No need to check staging by hand. In the “Requests” section, hover over any request to staging and click “Check the request in Monitoring”. The monitor checks the endpoint on a schedule while the app is open and sends a system notification when the endpoint works again.
Then click “Disable all mocks inside” on the same host. Requests go to the server again, and the first exchanges without the mock cube show whether staging drifted from what you recorded after the update.
A fallback for the whole team
Mocks are files in the workspace’s mocks folder. Put the workspace in git next to the app’s code, and the recorded staging responses will be there for everyone who clones it. Refresh the recording, and your teammates get the update with git pull.
If the app has to work without the proxy, at a demo or in automated tests, the same recording turns into a mock server on its own port. More on that in “Mock server from traffic: a copy of your real API in a minute”.
Record your staging responses with the beta while it works, and write to beta@microkoi.com: did they help during the next outage? We read every email.