TypeError [ERR_INVALID_ARG_TYPE]: The "paths[0]" argument must be of type string. Received an instance of Object
Maintainer antworten meist innerhalb von 2 Tagen
@sofisl arbeitet bereits daran.
Seit 26.2.2024.
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
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
- Vorherrschende Sprache
- TypeScript
- Sterne
- 12.3k
- Forks
- 2k
- Ø Merge
- 3 T. 10 Std.
- Gemergte PRs (30 T.)
- 9
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus googleapis/google-api-nodejs-client
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 86/100
googleapis/google-api-nodejs-client#4064 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 4/5 1-2 Tage Anfängerfreundlichkeit 5/100
googleapis/google-api-nodejs-client#4067 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 1/100
googleapis/google-api-nodejs-client#4063 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
eMudhra/emSign CA compromise (October 2026): what Cloud SDK Node.js Libraries developers need to doOffen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 10/100
googleapis/google-api-nodejs-client#4062 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 10/100
googleapis/google-api-nodejs-client#4061 ·
Maintainer antworten meist innerhalb von 2 Tagen
Alle Issues in googleapis/google-api-nodejs-client
Ähnliche Issues
-
parse: child keys like `007`, `1e3`, `0x1f`, `-1` make the parent an empty array and hide the valueOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
-
enhancement follow-up
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 62/100
bketelsen/pi-pocket-team#232 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug UI
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
wardian-app/Wardian#1746 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area: interop area: sip-core v3
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
fonoster/routr#705 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag