Google lens serpapi is giving me an abortsignal error. The code was the same the other day and now this error popped up?

261 views Asked by At

My nodejs script was working perfectly fine the other day and now I'm getting this abort signal error below. The code is literally copied verbatim from the serpapi site. I had my own code that's slightly different but I get the same error even when just using the site's sample code. https://serpapi.com/google-lens-api. It seems to be a local issue because when I ran it standalone on Replit it seemed to be fine. My package json is below as well.

import { getJson } from "serpapi";

const params = {
  url: "https://i.imgur.com/HBrB8p0.png",
  api_key: "{xxx}"
};

// Show result as JSON
const response = await getJson("google_lens", params);
console.log(response["visual_matches"]);
"name": "cheerio",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "type": "module",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@google-cloud/vision": "^3.1.1",
    "axios": "^1.3.2",
    "cheerio": "^1.0.0-rc.12",
    "jimp": "^0.22.4",
    "node-fetch": "^3.3.0",
    "openai": "^3.1.0",
    "serpapi": "^1.1.0"

signal: AbortSignal.timeout(timeout), ^ ReferenceError: AbortSignal is not defined

1

There are 1 answers

0
Mikhail Zub On

I think something wrong with your node environment. Try to remove your node_modules directory, install the latest node LTS version, and then install your dependencies again.