Vinny
Vinny
CCConvex Community
Created by Vinny on 10/28/2023 in #support-community
Consistently getting this error and not sure where to put platform: node
Hi, I'm currently a student hacker at Calhacks and I keep getting this error: [ERROR] Could not resolve "querystring" node_modules/centra/model/CentraRequest.js:4:19: 4 │ const qs = require('querystring') ╵ ~~~ The package "querystring" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error. ✘ [ERROR] Could not resolve "zlib" node_modules/centra/model/CentraRequest.js:5:21: 5 │ const zlib = require('zlib') ╵ ~~ The package "zlib" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error. ✘ [ERROR] Could not resolve "url" node_modules/centra/model/CentraRequest.js:6:22: 6 │ const {URL} = require('url') ╵ ~~~ This is my code: "use node"; import { v } from "convex/values"; import { action } from "./generated/server"; import { YoutubeTranscript } from 'youtube-transcript'; function mergeTextAndRemoveNewlines(data: any) { let mergedText = ''; for (let i = 0; i < data.length; i++) { const cleanedText = data[i].text.replace(/\n/g, '').trim(); mergedText += cleanedText + ' '; } return mergedText.trim(); } export const fetchTranscriptData = action({ args: { videoURL: v.string() }, handler: async (, args) => { { try { const transcriptData = await YoutubeTranscript.fetchTranscript(args.videoURL); const transcriptText = mergeTextAndRemoveNewlines(transcriptData); return transcriptText; } catch (error) { console.error('Error fetching transcript:', error); throw error; } } }, });
10 replies