I’m trying to replicate Thomas Frank video for building an audio to text system, using pipedream, chatgpt, google drive and notion. But I keep getting an error when using node.js “Cannot read property ‘length’ of null”. Link of the video:
How I Use AI to take perfect notes...without typing - YouTube
The code I’m trying is the following:
export default defineComponent({
async run({ steps, $ }) {
const results = {
title: "",
transcript: "",
summary: "",
additional_info: ""
// Add line breaks to the transcript
const originalTranscript = steps.create_transcription.$return_value.transcription
function splitStringIntoSentences(str) {
const sentences = str.match(/(?:^|[^.!?]+)[.!?]+\s?/g) // split into sentences
const result = []
for (let i = 0; i < sentences.length; i += 3) {
result.push(sentences.slice(i, i + 3).join(' ')) // join 3 sentences
return result
function joinArrayWithBlankLine(arr) {
return arr.join('\n\n')
const transcriptArray = splitStringIntoSentences(originalTranscript)
results.transcript = joinArrayWithBlankLine(transcriptArray)
// Extract the summary
const summary = steps.chat.$return_value.choices[0].message.content
function splitSummary(str) {
const titleDelimiter = /^.*\n\n/
const summaryDelimiter = /\n\s*?--Summary--\s*?\n\s*/
const additionalInfoDelimiter = /\n\s*?--Additional Info--\s*?\n\s*/;
const titleMatch = str.match(titleDelimiter)
const summaryMatch = str.match(summaryDelimiter)
const additionalInfoMatch = str.match(additionalInfoDelimiter)
if (!titleMatch || !summaryMatch || !additionalInfoMatch) {
console.log("One or more delimiters not found")
return str
} else {
const titleIndex = titleMatch.index
const summaryIndex = summaryMatch.index
const additionalInfoIndex = additionalInfoMatch.index
results.title = str.slice(0, titleIndex + titleMatch[0].length).trim().replace(/^#\s*/,"")
results.summary = str.slice(summaryIndex + summaryMatch[0].length, additionalInfoIndex).trim()
results.additional_info = str.slice(additionalInfoIndex + additionalInfoMatch[0].length).trim()
splitSummary(summary)
// Return the results object
return results
Hello @ecasanova1995, @CymaticLab,
First off, welcome to Pipedream! Happy to have you!
Could you confirm that you have executed all previous steps successfully before executing the step having error?
The reason is that your code step will use the data from your previous step, if you have not executed the previous step then there would be no data to reference to.
I’m not sure about your whole workflow context. My recommendation for now is you can watch the video again and follow them step by step. I have seen some people successfully make it work:
Speech to Text to Notion - #7 by chickanan
Thomas Franke Voice to Transcript, failing at final hurdle. Any ideas? - #3 by colinconsterdine