Skip to content
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/apify-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,10 @@ function addUserAgent(config: AxiosRequestConfig): AxiosRequestConfig {
return updatedConfig;
}

export function getApifyAPIBaseUrl(): string {
// Workaround for Actor server where the platform APIFY_API_BASE_URL did not work with getActorDefinition from actors.ts
if (process.env.APIFY_IS_AT_HOME) return 'https://api.apify.com';
return process.env.APIFY_API_BASE_URL || 'https://api.apify.com';
}
Comment on lines -19 to -23
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: The workaround did not work when running the platform locally, and probably would not work on staging as well.
Where was the APIFY_API_BASE_URL env var missing?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch, this was actually a hack from @MQ37

This package is imported in apify-mcp-server where APIFY_API_BASE_URL is defined 🙈.
Here is a TODO for that https://github.com/apify/apify-mcp-server/blob/0b336190178ad85beb1ee83956924d98c0eb129b/src/main.ts#L18

I'm not sure if we'll have time to fix it this week.


export class ApifyClient extends _ApifyClient {
constructor(options: ApifyClientOptions) {
super({
...options,
baseUrl: getApifyAPIBaseUrl(),
requestInterceptors: [addUserAgent],
});
}
Expand Down
Loading