Rork generates the code, you preview the app—and then nothing loads. The screen is blank, the console shows an error, or data is fetched but never appears. Network and API failures are among the most common issues in app development, and understanding how to diagnose them makes the difference between being stuck for an hour and resolving it in minutes.
This guide walks through each failure type with clear diagnostic steps and Rork AI prompts you can use to get to a fix.
Identify Your Failure Type First
Network issues in Rork apps fall into five patterns. Finding the right one saves significant time.
① "Network request failed" in the console The device or simulator can't reach the server at all. Usually a wrong URL, HTTP vs. HTTPS issue, or a development environment configuration problem.
② CORS error (in web view or development) A browser security policy is blocking a cross-origin request. Common during development; may not appear in production builds.
③ 404 Not Found response The URL is wrong, the endpoint doesn't exist, or the API path has changed.
④ 401 Unauthorized or 403 Forbidden Authentication credentials are missing, malformed, or expired.
⑤ Data arrives but nothing displays The fetch itself succeeded, but the JSON structure doesn't match what the code expects.
Step 1: Check the Rork Debug Console
Before anything else, open the debug console in Rork's development environment. Most network errors include a specific message that tells you exactly what went wrong.
Open the "Debug" or "Console" tab in Rork and trigger the action that causes the failure. Read the error message carefully—it almost always contains the root cause.
Once you have the error message, share it with Rork AI:
"I'm seeing this error in the console: [paste error message here].
What's causing it and how do I fix it?"
This single step resolves a significant portion of network issues.
Step 2: Verify the API URL and Endpoint
If you're seeing a "Network request failed" or "404 Not Found" error, start with the URL.
"The app is requesting https://example-api.com/users but getting a 404.
Check whether the base URL and endpoint path are correct.
The API documentation says the correct endpoint is [paste docs here]."
You can also verify the URL independently by testing it in Postman or running a curl command:
curl -X GET "https://example-api.com/users" \
-H "Authorization: Bearer YOUR_TOKEN"If the curl command also returns a 404, the issue is with the URL itself. If curl works but the app doesn't, the issue is in how the app is constructing the request.
Step 3: Resolve CORS Errors in Development
CORS errors appear when a web view or browser-based preview tries to make a cross-origin request that the server hasn't explicitly permitted. These are common during development and often don't appear in native app builds.
Option A: Use a development proxy
"I'm getting a CORS error when fetching from https://api.example.com in the Expo web preview.
Set up a development proxy using expo-router's API routes to forward requests to the external API,
so the request appears to come from the same origin."
Option B: Configure the API server (if you control it)
If you own the API server, add the development origin to your CORS allowlist. For Node.js/Express:
// Allow requests from Expo development server
app.use(cors({
origin: ['http://localhost:8081', 'https://yourproductiondomain.com']
}));Step 4: Fix Authentication Errors (401/403)
Authentication failures are almost always a configuration problem on the client side.
Check how the API key is being passed
"The app is returning a 401 error. The API key is stored in the EXPO_PUBLIC_API_KEY environment variable.
Check whether the request is including it in the correct header format:
'Authorization: Bearer [token]'. If not, fix the request headers."
Environment variable naming in Expo
Environment variables in Expo must be prefixed with EXPO_PUBLIC_ to be accessible in client-side code. If the variable is named API_KEY instead of EXPO_PUBLIC_API_KEY, the client code will read it as undefined.
"The API key environment variable is named API_KEY but it's returning undefined.
Rename it to EXPO_PUBLIC_API_KEY in the .env file and update all references in the code."
Step 5: Fix Data Mapping When Display is Empty
If the network request completes successfully but the screen stays blank, the data structure from the API doesn't match what the rendering code expects.
"The API call succeeds (status 200) but the screen shows nothing.
Add a console.log to print the raw API response, then update the data mapping
to match the actual response structure."
After Rork adds the log and you see the response structure, a follow-up prompt resolves the mapping:
"The response looks like this: [paste logged response].
The code expects data.items[] but the response uses data.results[].
Update the mapping."
Common Scenarios with Ready-to-Use Prompts
iOS blocking HTTP (non-HTTPS) APIs
"The app works on Android but fails on iOS with an ATS (App Transport Security) error.
The API only supports HTTP, not HTTPS. Add an ATS exception in app.json for development.
Include a comment noting that HTTPS migration is required before production."
Frequent timeout errors
"API responses are slow and the app is timing out. Increase the fetch timeout to 15 seconds
and add retry logic: retry once after 2 seconds if the first request times out."
Pagination not loading additional pages
"Only the first page of results loads. The API supports pagination with ?page=N.
Implement a loadMore function that fetches the next page when the user scrolls to the bottom,
and append the new items to the existing list without replacing it."
Looking back
Almost every network failure in a Rork app can be diagnosed from the error message and resolved with a targeted Rork AI prompt. The workflow is straightforward.
Open the debug console and read the error carefully. Match it to one of the five failure types above. Use the corresponding prompt to ask Rork AI to fix it. Test again and check whether the error is resolved.
The most effective thing you can do when stuck is paste the exact error message into Rork's chat and ask what caused it. Rork AI is quite good at reading error output and suggesting the right fix—you don't need to diagnose it yourself.