ProjectOpenSea / opensea-js

TypeScript SDK for the OpenSea marketplace
https://docs.opensea.io/reference
MIT License
2.28k stars 964 forks source link

opensea-js 7.1.0: (0 , promises_1.setTimeout) is not a function #1424

Closed aashborn closed 8 months ago

aashborn commented 8 months ago

Component

Other (please describe)

Have you ensured that all of these are up to date?

What version of opensea-js are you on?

7.1.0

What function is the bug in?

createListing

Operating System

Windows

Describe the bug

I'm trying to migrate from opensea-js 7.0.8 to version 7.1.0, for Seaport 1.6 support.

We use openseajs as a dependency in our frontend. When testing the upgrade I get an error and a warning.

The error prevents listing creation:

Error when listing the token TypeError: (0 , promises_1.setTimeout) is not a function
    at req.retryFunc (opensea-js.js?v=4cdf88ba:61136:43)
    at _FetchRequest.send_fn (opensea-js.js?v=4cdf88ba:1887:50)
    at async OpenSeaAPI._fetch (opensea-js.js?v=4cdf88ba:61143:26)
    at async OpenSeaAPI.get (opensea-js.js?v=4cdf88ba:61091:16)
    at async OpenSeaAPI.getCollection (opensea-js.js?v=4cdf88ba:61038:26)
    at async OpenSeaSDK.createListing (opensea-js.js?v=4cdf88ba:62484:28)

The same error occurs when I directly invoke the function getOrders :

TypeError: (0 , promises_1.setTimeout) is not a function
    at req.retryFunc (opensea-js.js?v=4cdf88ba:61136:43)
    at _FetchRequest.send_fn (opensea-js.js?v=4cdf88ba:1887:50)
    at async OpenSeaAPI._fetch (opensea-js.js?v=4cdf88ba:61143:26)
    at async OpenSeaAPI.get (opensea-js.js?v=4cdf88ba:61091:16)
    at async OpenSeaAPI.getOrders (opensea-js.js?v=4cdf88ba:60839:26)

And I have this warning from the Vite tool we use: Module "timers/promises" has been externalized for browser compatibility. Cannot access "timers/promises.setTimeout" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.

Here's what Vite says about it: https://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility

We recommend avoiding Node.js modules for browser code to reduce the bundle size, although you can add polyfills manually. If the module is imported from a third-party library (that's meant to be used in the browser), it's advised to report the issue to the respective library.