oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.94k stars 2.75k forks source link

googlethis module on npm throws error in normal usage #2461

Closed u9g closed 1 year ago

u9g commented 1 year ago

What version of Bun is running?

0.5.9

What platform is your computer?

Linux 5.17.0-1021-oem x86_64 x86_64

What steps can reproduce the bug?

  1. install googlethis
  2. Run this
    
    import google from "googlethis"

const response = await google.search("TWDG") console.log(response)


### What is the expected behavior?

return data expected

### What do you see instead?

bun run goog.ts 03/22/2023 09:40:10 PM 2 | 3 | const userAgents = require('./user-agents.json'); 4 | 5 | class SearchError extends Error { 6 | constructor (message, info) { 7 | super(message); ^ error: Could not execute search info: { "status_code": 0, "message": "The socket connection was closed unexpectedly. For more information, pass verbose: true in the second argument to fetch()" }

  at new SearchError (/home/u9g/code/3-22-23/midnightskycheats/node_modules/googlethis/lib/utils/utils.js:7:4)
  at /home/u9g/code/3-22-23/midnightskycheats/node_modules/googlethis/lib/core/main.js:70:10


### Additional information

_No response_
Electroid commented 1 year ago

We've fixed the issues that caused this bug. Tested in Bun v1.0.7.

❯ bun google.ts 
{
  results: [],
  videos: [],
  knowledge_panel: {
    type: "Game series",
    title: "The Walking Dead",
    description: "The Walking Dead is an episodic graphic adventure game series developed and published by Telltale Games and Skybound Games. It is based on the comic book series of the same name by Robert Kirkman, Tony Moore, and Charlie Adler. Wikipedia",
    url: "https://en.wikipedia.org/wiki/The_Walking_Dead_(video_game_series)",
    metadata: [
      [Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...]
    ],
    books: [],
    tv_shows_and_movies: [],
    ratings: [],
    available_on: [],
    images: [],
    songs: [],
    socials: [],
    demonstration: null,
    lyrics: null
  },
  featured_snippet: {
    title: null,
    description: null,
    url: null
  },
  did_you_mean: null,
  weather: {
    location: null,
    forecast: null,
    precipitation: null,
    humidity: null,
    temperature: null,
    wind: null,
    image: null
  },
  time: {
    hours: null,
    date: null
  },
  location: {
    title: null,
    distance: null,
    map: null
  },
  dictionary: {
    word: null,
    phonetic: null,
    audio: null,
    definitions: [],
    examples: []
  },
  translation: {
    source_language: null,
    target_language: null,
    source_text: null,
    target_text: null
  },
  top_stories: [],
  unit_converter: {},
  people_also_ask: [ "In what order should I play The Walking Dead games?", "How old is Clementine in TWDG s2?",
    "Is Walking Dead 12 coming?" ],
  people_also_search: []
}