-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
@google-cloud/storage throws errors with bun #6200
Comments
So I did a little bit of digging and it seems like its coming from If I replace the usage of
Another interesting thing that I noticed, is that I put in
|
Actually, my little hack of replacing the
Logging the value of
|
+1! im also having similar issues. I can't list buckets or files, the process exits with code 0 and no message. Example Code: export const gcs = new Storage({
keyFile: process.cwd() + "/gcs.json",
projectId: "project-id-here",
})
gcs.getBuckets().then((res) => console.log(res)).catch((err) => console.error(err)) Output: nikos@nikos server % bun run src/index.ts
Server running on port 4000
nikos@nikos server % I have no idea as to what might be the reason, ill update when I find something |
@andriotisnikos1 , try adding an |
@Xiot I did try it before. as you said, im getting nothing logged to the console, the process just exits. I tried running the server with |
+1 here, I am seeing the following: When simply trying to call files from a bucket:
|
Looks like another issue im facing with a @Google-Cloud package as i did the same hack that @Xiot did and made my issue go away.
|
I also have problems with // pkgs/storage/node_modules/gaxios/build/src/gaxios.js
// source of error
219 | if (is_stream_1.default.readable(opts.data)) {
220 | opts.body = opts.data;
^
TypeError: undefined is not an object (evaluating 'is_stream_1.default.readable')
at /home/alex/workspace/rupurt/eve/pkgs/storage/node_modules/gaxios/build/src/gaxios.js:220:33 // pkgs/storage/node_modules/gaxios/build/src/gaxios.js
// import section
Object.defineProperty(exports, "__esModule", { value: true });
exports.Gaxios = void 0;
const extend_1 = __importDefault(require("extend"));
const https_1 = require("https");
const node_fetch_1 = __importDefault(require("node-fetch"));
const querystring_1 = __importDefault(require("querystring"));
const is_stream_1 = __importDefault(require("is-stream")); This is what is_stream_1: Module {
__esModule: true,
isDuplexStream: [Function: isDuplexStream],
isReadableStream: [Function: isReadableStream],
isStream: [Function: isStream],
isTransformStream: [Function: isTransformStream],
isWritableStream: [Function: isWritableStream]
}
is_stream_1.default: undefined |
Aha! I get the segfault when I manually replace // package.json
// ...
"is-stream": "^3.0.0",
"node-fetch": "^3.3.2"
// ... |
There is also a bug here where |
You da man @Jarred-Sumner. Super quick turnaround. I can confirm it's now working with GCS on |
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
bun --revision I'm having a similar issue on bucket.upload(). The program will successfully upload the file but throws an error import { Storage } from "@google-cloud/storage";
const main = async () => {
const storage = new Storage({
keyFilename: `./google-cloud-key.json`,
});
const bucketName = "bun-test-bucket";
const filePath = "./test.txt";
const bucket = storage.bucket(bucketName);
// Sending the upload request
bucket.upload(
filePath,
{
destination: `test.txt`,
},
function (err, file) {
if (err) {
console.error(`Error uploading ${filePath}: ${err}`);
} else {
console.log(`txt file uploaded to ${bucketName}.`, file?.name);
}
}
);
};
main(); ➜ test bun run main.ts
1 | (function (controller) {"use strict";
^
TypeError: undefined is not an object
at readableStreamDefaultControllerCanCloseOrEnqueue (:1:20)
at readableStreamDefaultControllerCallPullIfNeeded (:1:20)
at processTicksAndRejections (:61:76)
txt file uploaded to bun-test-bucket. test.txt |
@seanwessmith I get the same error. Only GET requests seem to work without errors. |
I can confirm my issue with Get is now resolved with the latest version of bun 1.0.13 |
@Jarred-Sumner Just wanted to call out that I am attempting to use the node GCS storage SDK to download stuff and it seems that bun is just exiting the process with code 0. Tried to get more information through inspect or try / catches, but no luck. Just a clean exit every time. |
@Scalahansolo do you have more info, maybe an example file? I just tried this on Bun 1.0.18 and it lists the files correctly. import { Storage } from "@google-cloud/storage";
const storageClient = new Storage({
keyFilename: "./key.json",
});
export const getFiles = async (bucketName: string) => {
try {
const bucket = storageClient.bucket(bucketName);
const [files] = await bucket.getFiles();
console.log("Files:");
files.forEach((file) => {
console.log(file.name);
});
return files;
} catch (error) {
console.error("Error fetching GCS objects:", error);
throw error;
}
};
const bucketName = "test-bucket";
getFiles(bucketName); bun run main.ts
Files:
backups//tmp/test.sqlite
backups/tes.sqlite
test.sqlite
test.txt |
Hey @seanwessmith . Get files works fine for me as well. Trying to actually download the files is where I have problems with the early exit. Downloading either through the single file or through a TransferManager have the issue of the process exit. |
I'm getting this error when trying to sign a url using gcloud library:
Any idea why this might be happening? My docker file:
The issue happens with the oven:bun image too. But when i run the same docker file in my local machine, everything works normally. |
What version of Bun is running?
1.0.3+25e69c71e70ac8a0a88f9cf15b4057bd7b2a633a
What platform is your computer?
Darwin 22.5.0 arm64 arm
What steps can reproduce the bug?
> bun test.mjs
What is the expected behavior?
the call to
getMetadata()
returns successfullyWhat do you see instead?
Additional information
The call returns in about
200ms
when run vianode v20.6.1
The text was updated successfully, but these errors were encountered: