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

v0.7.2+ regression: TypeError: undefined is not an object (evaluating '__classPrivateFieldGet(this, _Client_fetch, "f").call') #4029

Closed
azu opened this issue Aug 6, 2023 · 2 comments · Fixed by #4032
Assignees
Labels
bug Something isn't working

Comments

@azu
Copy link

azu commented Aug 6, 2023

What version of Bun is running?

0.7.3

What platform is your computer?

Darwin 22.6.0 arm64 arm

What steps can reproduce the bug?

git clone https://github.com/azu/bun-notion-client-bug
cd bun-notion-client-bug
bun install
bun run index.ts

334 |         };
335 |         if (bodyAsJsonString !== undefined) {
336 |             headers["content-type"] = "application/json";
337 |         }
338 |         try {
339 |             const response = await errors_1.RequestTimeoutError.rejectAfterTimeout(__classPrivateFieldGet(this, _Client_fetch, "f").call(this, url.toString(), {
                                                                                      ^
TypeError: undefined is not an object (evaluating '__classPrivateFieldGet(this, _Client_fetch, "f").call')
      at /Users/azu/ghq/github.com/azu/bun-notion-client-bug/node_modules/@notionhq/client/build/src/Client.js:339:83
      at request (/Users/azu/ghq/github.com/azu/bun-notion-client-bug/node_modules/@notionhq/client/build/src/Client.js:311:20)
      at /Users/azu/ghq/github.com/azu/bun-notion-client-bug/index.ts:3:23
  • Reproduce Code:

idnex.ts:

import { Client } from "@notionhq/client";
const notion = new Client({ auth: "secret_dummy" });
const response = await notion.databases.query({
    database_id: "dummy",
    filter: {
        property: 'Name',
        title: {
            "equals": "test"
        }
    }
});

What is the expected behavior?

Can fetch.

(This reproduce repo uses dummy api token for easy testing, so It will be "API token is invalid." error.)

What do you see instead?

Throw an runtime error.
Probably, Its related with WeakMap.

334 |         };
335 |         if (bodyAsJsonString !== undefined) {
336 |             headers["content-type"] = "application/json";
337 |         }
338 |         try {
339 |             const response = await errors_1.RequestTimeoutError.rejectAfterTimeout(__classPrivateFieldGet(this, _Client_fetch, "f").call(this, url.toString(), {
                                                                                      ^
TypeError: undefined is not an object (evaluating '__classPrivateFieldGet(this, _Client_fetch, "f").call')
      at /Users/azu/ghq/github.com/azu/bun-notion-client-bug/node_modules/@notionhq/client/build/src/Client.js:339:83
      at request (/Users/azu/ghq/github.com/azu/bun-notion-client-bug/node_modules/@notionhq/client/build/src/Client.js:311:20)
      at /Users/azu/ghq/github.com/azu/bun-notion-client-bug/index.ts:3:23

https://github.com/azu/bun-notion-client-bug/blob/8bee7e1c53dd7ab5ed1b94a1305d8fde7b11ff9c/node_modules/%40notionhq/client/build/src/Client.js#L339
https://github.com/azu/bun-notion-client-bug/blob/8bee7e1c53dd7ab5ed1b94a1305d8fde7b11ff9c/node_modules/@notionhq/client/build/src/Client.js#L8-L11

This __classPrivateFieldGet(...) returns undefined and cause this error.

Additional information

I've tested bun 0.7.1 and work fine

Version Result
0.7.1 🟢
0.7.2 🟥
0.7.3 🟥

I think that this regression is introruded in bun 0.7.2.

@azu azu added the bug Something isn't working label Aug 6, 2023
@Jarred-Sumner
Copy link
Collaborator

@paperdave this most likely came from converting our builtins to CJS

@Jarred-Sumner
Copy link
Collaborator

Confirming the linked PR fixes it

image

Jarred-Sumner added a commit that referenced this issue Aug 7, 2023
* Fixes #4029 and Fixes #4022

Fixes #4029

Fixes #4022

* Add test for all the fetches

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
trnxdev pushed a commit to trnxdev/bun that referenced this issue Aug 9, 2023
* Fixes oven-sh#4029 and Fixes oven-sh#4022

Fixes oven-sh#4029

Fixes oven-sh#4022

* Add test for all the fetches

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants