Speech to Notion (Thomas Frank coded method) Duration Number error

I just followed the tutorial and at the first try with the example audio I got my note on notion succesfully but right now I’m just getting the next error: “Error Invalid duration number (thrown from calculateTranscriptCost). DETAILS at Object.calculateTranscriptCost (file:///pipedream/dist/code/4cf355a52ab0f9c275ba953eea42492276c4b796f961fdffefa87942b1ced4df/code/Notion-Voice-Notes.mjs:1151:11) at Object.run (file:///pipedream/dist/code/4cf355a52ab0f9c275ba953eea42492276c4b796f961fdffefa87942b1ced4df/code/Notion-Voice-Notes.mjs:1983:41) at null.executeComponent (/var/task/launch_worker.js:294:22) at MessagePort.messageHandler (/var/task/launch_worker.js:791:28)”

I hope someone can help me fix it

Hi @diegollamozas911,

It seems like you’re encountering an error related to the calculateTranscriptCost function within your Pipedream workflow, specifically when trying to integrate audio transcription with Notion. The error message indicates an issue with an “Invalid duration number”, which suggests that the function calculateTranscriptCost is receiving an unexpected value for the audio duration.

Without seeing the specific code within Notion-Voice-Notes.mjs, it’s difficult to provide a precise solution. However, the error likely stems from how the duration of the audio file is being calculated or passed to the calculateTranscriptCost function. Here are a few steps you can take to troubleshoot and potentially resolve the issue:

  1. Verify Audio File Metadata: Ensure that the audio file you’re trying to transcribe has valid metadata, including a clearly defined duration. Some audio files might not have this metadata properly set, which could lead to issues when trying to calculate costs based on duration.

  2. Check Duration Calculation: Review the part of your code that calculates or retrieves the duration of the audio file. Ensure that this calculation or retrieval process is accurate and that the duration is being passed as a number to the calculateTranscriptCost function.

  3. Debugging: Add logging statements before the call to calculateTranscriptCost to log the value of the duration being passed. This can help you identify whether the duration is indeed invalid or not being calculated as expected.

  4. Review calculateTranscriptCost Implementation: If possible, review the implementation of the calculateTranscriptCost function to understand how it’s using the duration and what validations it’s performing. Ensure that the function is correctly handling the duration value.

  5. Consult Documentation: Review any relevant documentation or examples related to the audio transcription service you’re using. There might be specific requirements or limitations regarding the audio files or their duration.

If after these steps you’re still encountering issues, it might be helpful to reach out for more specific support. You can visit Pipedream Support for further assistance.

I’m a bot powered by Pipedream and GPT-4. I’m still learning, so please double-check my answers and code! Learn how to build your own.