TypeError [ERR_INVALID_ARG_TYPE]: The "paths[0]" argument must be of type string. Received an instance of Object
メンテナーはふだん 2 日以内に返信
@sofisl がすでに取り組んでいます。
2024年2月26日 から。
評価
この issue はまだ評価されていません。
説明
hi i got this error
"TypeError [ERR_INVALID_ARG_TYPE]: The "paths[0]" argument must be of type string. Received an instance of Object"
every time i try to upload a file to my drive account and here is the code
"use server";
import { google } from "googleapis";
import * as fs from "fs";
import { join } from "path";
export async function addFile(e: FormData) {
const file: File | null = e.get("file") as unknown as File;
const bytes = await file?.arrayBuffer();
const buffer = Buffer.from(bytes);
const path = join("/", "/tmp", file.name.trim());
fs.writeFileSync(path, buffer);
const keyFile = await JSON.parse(
fs.readFileSync(process.cwd() + `/src/app/key.json`, "utf-8")
);
const auth = new google.auth.GoogleAuth({
keyFile,
scopes: ["https://www.googleapis.com/auth/drive"],
});
const drive = google.drive({
version: "v3",
auth,
});
const response = () => {
return new Promise((resolve, reject) => {
drive.files.create(
{
requestBody: {
name: file.name,
parents: ["1TebOIirZf_P9xb2Vc2fAVhdMrTU_rN-U"],
},
media: {
body: fs.createReadStream(path),
mimeType: file.type.toString(),
},
fields: "id",
},
function (err, file) {
if (err) {
reject(err);
}
resolve(file);
}
);
});
};
await response().catch((err) => console.log(err));
}
so could any one help with that or have a tip for solve this problem
i use next.js 14.1.0 as a javascript frame work node with version 20.9.0
- 主要言語
- TypeScript
- スター
- 12.3k
- フォーク
- 2k
- 平均マージ
- 3日 10時間
- マージ済み PR(30日)
- 9
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
googleapis/google-api-nodejs-client のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
googleapis/google-api-nodejs-client#4064 ·
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 1〜2日 初心者へのやさしさ 5/100
googleapis/google-api-nodejs-client#4067 ·
メンテナーはふだん 2 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 1/100
googleapis/google-api-nodejs-client#4063 ·
メンテナーはふだん 2 日以内に返信
-
eMudhra/emSign CA compromise (October 2026): what Cloud SDK Node.js Libraries developers need to doオープン
難易度 1/5 1時間未満 初心者へのやさしさ 10/100
googleapis/google-api-nodejs-client#4062 ·
メンテナーはふだん 2 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
googleapis/google-api-nodejs-client#4061 ·
メンテナーはふだん 2 日以内に返信
googleapis/google-api-nodejs-client の issue をすべて見る
似ている issue
-
bug UI
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
wardian-app/Wardian#1746 ·
メンテナーはふだん 1 日以内に返信
-
area: interop area: sip-core v3
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
fonoster/routr#705 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P2
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
openclaw/openclaw#198551 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信