oven-sh / bun

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

notion-client is not supported #7216

Open Parker-Bergen opened 9 months ago

Parker-Bergen commented 9 months ago

What version of Bun is running?

1.0.13+f5bf67bd1

What platform is your computer?

arwin 23.0.0 arm64 arm

What steps can reproduce the bug?

Install notion-client. Try and use NotionAPI and attempt to retrieve anything. The code below allows you to run it with bun and node to see that it works with node and does not function with bun.

import { NotionAPI } from 'notion-client'
import express from 'express'

const api = new NotionAPI()

const app = express()
const port = 3005

app.get('/', async (req, res) => {
  const page = await api.getPage('788a6cc235564be8bdbaf322ceb5ad79');
  console.log(page)
  res.send(JSON.stringify(page));
})

app.listen(port, () => {
  console.log(`Example app listening on port ${port}`)
})

What is the expected behavior?

The line of const page = await api.getPage('788a6cc235564be8bdbaf322ceb5ad79'); should return something

What do you see instead?

Currently it fails silently and does nothing

Additional information

Even with when run with bun and having node installed on the machine it does not function. It must be run with node to function properly.

Jarred-Sumner commented 9 months ago

Debug logs:

Example app listening on port 3005
[RequestContext] create (src.bun.js.api.server.NewRequestContext(false,true,src.bun.js.api.server.NewServer(ZigGeneratedClasses.JSDebugHTTPServer,false,true))@20000c00100)
[MEM] malloc(42) = 42
[MEM] malloc(128) = 170
[MEM] malloc(146) = 316
[MEM] malloc(800) = 1116
[MEM] malloc(2672) = 3788
[Loop] ref
[MEM] report(3788)
[uws] connect(www.notion.so, 443)
[fetch] onStart: 7.837ms
[fetch] Processed 1 tasks
[RequestContext] toAsync
[fetch] Connected https://www.notion.so/api/v3/loadPageChunk
[fetch] onHandshake(0x0000600000BDC460) authorized: true error:
[uws] us_socket_write(src.deps.boringssl.translated.SSL@6000017d8008, 373) = 373
[fetch] onData 4051
[fetch] handleResponseMetadata: content_length is null and transfer_encoding src.http_client_async.Encoding.chunked
[MEM] malloc(1872) = 5660
[MEM] malloc(864) = 6524
[fetch] progressUpdate true
[fetch] releaseSocket(0x0000600000BDC460)
[fetch] Keep-Alive release www.notion.so:443 (0x105553128703072)
[fetch] onAsyncHTTPCallback: 102.953ms
[FetchTasklet] callback success true has_more false bytes 2084
[FetchTasklet] added callback metadata
[MEM] malloc(3063) = 9587
[FetchTasklet] onProgressUpdate
[FetchTasklet] onResolve
[FetchTasklet] toResponse
[MEM] discard(3063) = 6524
[FetchTasklet] onProgressUpdate: promise_value is not null
[FetchTasklet] clearData
[MEM] free(42) = 6482
[MEM] free(128) = 6354
[MEM] free(146) = 6208
[MEM] free(1872) = 4336
[MEM] free(864) = 3472
[FetchTasklet] deinit
[MEM] free(2672) = 800
[MEM] free(800) = 0
Parker-Bergen commented 9 months ago

I'm not sure if thats meant for me or not? Is this something I can resolve or be resolved soon?