jshemas / openGraphScraper

Node.js scraper service for Open Graph Info and More!
MIT License
643 stars 102 forks source link

open-graph-scraper > 4.11.1 jest and supertest segfault #162

Closed alexng353 closed 1 year ago

alexng353 commented 1 year ago

See the recreation repository here

Below is the pasted readme which should contain all the necessary information.

ogs-bug-example

Description

A repostiory to demonstrate a bug in the open-graph-scraper package above the version 4.11.1.

Steps to reproduce

  1. Clone this repository
  2. Run yarn
  3. Run yarn test
  4. Watch the program segfault

Expected behavior

The program should not segfault.

Actual behavior

The program segfaults.

image

Notes

If you start the server with yarn start and just go to http://localhost:3555, the code doesn't segfault. It only segfaults when you run the test.

I'm not sure if this means that supertest or jest is at fault, but I'm submitting an issue anyways.

Environment

Additional info

Installing open-graph-scraper 4.11.1 and running the test will not segfault. See branch 4.11.1

jshemas commented 1 year ago

Hello,

Thanks for making a test repo, that really help with debugging this issue. It looks like the problem is with the dynamic import for got because openGraphScraper is using CommonJS. I believe this issue is related to this and this.

Have you try using a different test runner?

alexng353 commented 1 year ago

No, I have not tried using a different test runner. I've just cloned my test repo to codespaces, I'm gonna heck around until I find out. Thanks so much for the help @jshemas.

P.S. This is my first time making issues, is there anything that you'd like to give me feedback on? Thanks so much in advance.

jshemas commented 1 year ago

I don't have any feedback for you but I did really appreciate the working example of the problem!