How to use Apify Proxy with NodeJS Fetch API in an...
# apify-platform
o
I’m building an Apify actor where I first populate userData with data from an external API (using fetch) and then make browser requests. How do I configure Apify Proxy for both stages to use the same proxies and ensure data consistency?
Copy code
js
const options: RequestOptions = {
    url: url,
    userData: { apiResponce: apiResponce },
};
await crawler.run(options);
h
Someone will reply to you shortly. In the meantime, this might help: -# This post was marked as solved by Alex I. [View answer]().
o
Huh, ok I follow to Ask AI and found https://docs.apify.com/sdk/js/docs/3.1/guides/apify-platform#apify-proxy
Copy code
js
import { Actor } from 'apify';

// Create proxy configuration
const proxyConfiguration = await Actor.createProxyConfiguration();

// Get a proxy URL to use with fetch
const proxyUrl = await proxyConfiguration.newUrl();

// Use the same proxyConfiguration for both fetch and crawler
// First for your API calls
// Then pass it to your crawler configuration