Skip to content

I get error 400 when connecting environment to my project. Without connection - works correctly #1573

Open
@emargin

Description

@emargin

Describe the Bug
I get error 400 when connecting environment to my project. Without connection - works correctly

Expected Behavior

import FirecrawlApp, {ScrapeResponse} from '@mendable/firecrawl-js';

// import * as dotenv from 'dotenv'; // if add this lines i get the 400 error
// dotenv.config({path: '.env.development'});

async function scrapePage(
  url: string
): Promise<ScrapeResponse<PageContent, never>> {
  try {
    const app = new FirecrawlApp({
      apiKey: FIRECRAWL_API_KEY,
    });

    console.log('scraping page', app);

    const crawlResponse = await app.scrapeUrl(url, {
      formats: ['json'],
      jsonOptions: {
        schema: schema,
        prompt: EXTRACT_PROMPT,
      },
    });

    if (!crawlResponse.success) {
      throw new Error(`Failed to crawl: ${crawlResponse.error}`);
    }

    console.log(crawlResponse);
    return crawlResponse;
  } catch (error) {
    console.error('Error scraping page with FireCrawl:', error);
    throw error;
  }
}

Environment (please complete the following information):

  • OS: [Linux]
  • Firecrawl Version: [^1.25.0]
  • Node.js Version: [20.х and 22.x]

Logs

FirecrawlError: Failed to scrape URL. Status code: 400. Error: Unknown error occurred
    at FirecrawlApp.handleError (/home/maef/dev/redactor_ai/bot/node_modules/@mendable/firecrawl-js/dist/index.cjs:942:13)
    at FirecrawlApp.scrapeUrl (/home/maef/dev/redactor_ai/bot/node_modules/@mendable/firecrawl-js/dist/index.cjs:226:12)
    at processTicksAndRejections (node:internal/process/task_queues:95:5) {
  statusCode: 400,
  details: undefined
}

UPDATE
I tried to remove all variables from my environment file - the error stopped reproducing. In any case, the behavior of your solution is incorrect

removing this line from my .env solved the problem

# HTTPS_PROXY=http://****:***@**.**.***.***:*****

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions