Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turf v7 in BigQuery: TypeError: base intrinsic for Date.prototype.getTime exists, but the property is not available #2632

Open
svbatalov opened this issue Jun 25, 2024 · 1 comment

Comments

@svbatalov
Copy link

Hello. Thanks for this great library!

I've encountered the following error message when tried to use a browserified version of [email protected] in BigQuery:

TypeError: base intrinsic for Date.prototype.getTime exists, but the property is not available ...

The way I bundled the library

browserify -r @turf/turf -s turf > turf7.js

Then used it in a BQ UDF as follows:

CREATE TEMP FUNCTION tst()
RETURNS STRING
LANGUAGE js
OPTIONS (
    library=["gs://.../turf7.js"]
) AS """
""";

SELECT tst()

As a workaround, I created the entry point JS file and added this line

Date.prototype.getTime = () => {};

before requiring the library.

It looks like this issue is caused by the deep-equal library that references getTime here.

Not sure if there are any action items for this issue -- after all, it probably should be filed against deep-equal, so feel free to close it. Just wanted to log it here for anyone encountering similar issues.

Cheers,
Sergey

@smallsaucepan
Copy link
Member

Hi @svbatalov. Yeah, deep-equal has been causing us a few problems of late, and we're in the process of removing it as a dependency.

Keep an eye on #2623 and #2631. Once they're both merged and shipped, see if that solves your issue. If the problem persists add a comment here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants