Comments (4)
Sounds like response.formats
is undefined or not an array here winstonma@4943baa#diff-ef15b8379e2c69cbf9fc5eb96c161ee3R12
Add a console.log(response.formats)
and a check to verify that value exists before calling the ytdl.chooseFormat
function
from functions.netlify.com.
Thanks @DavidWells. I added the console.log and confirm that response.formats only have content half of the time, when it is deployed.
When I download my own repo and run locally there is no problem, but the error exist only when it is deployed on Netlify.
May I rewrite my test case here:
- Run the Youtube API using the browser, and run it multiple times (browser refresh).
- Run the Youtube (Full) API using the browser, and run it multiple times (browser refresh).
I observe that the first API runs perfectly but the second API only works 50% of the time. Since these 2 APIs are using the same ytdl-core so I would likely to rule out the problem is caused by the module. But I am not sure if the few additional lines of the Full version causes the Netlify function to break.
Additional question:
I would like to attach the Netlify Function log, after calling the API multiple times:
8:30:33 AM: Duration: 7.92 ms Memory Usage: 96 MB
8:30:36 AM: Duration: 721.67 ms Memory Usage: 96 MB
8:30:39 AM: Duration: 10.96 ms Memory Usage: 96 MB
8:31:33 AM: Duration: 641.21 ms Memory Usage: 96 MB
8:31:36 AM: Duration: 4.93 ms Memory Usage: 96 MB
8:31:46 AM: Duration: 697.44 ms Memory Usage: 96 MB
Since the API calls are independent, I would expect the API call duration is more or less similar. However the log shows that the duration of Netlify Function is not flat, and instead the duration value of every other calls are too low that it seems it didn't collect the data from the Youtube Server. This behavior exist when the same API parameter is being used (e.g. browser refresh) and it doesn't applies when parameter is changed between API calls. Here is another example:
- Run the Youtube (Full) API with parameter (UVV80kTudSM)
- Run the Youtube (Full) API with parameter (DylgPyQxDiI)
- Loop through Step 1 and Step 2
When I run the above sequence, the Youtube (Full) API works fine. The API fails only when the same API (with the same parameter) is being called again. Therefore it seems to me that the Netlify Function would use the cached result when the same API parameter is being used again.
Thanks again for your time.
from functions.netlify.com.
Hi @DavidWells Do you know if Netlify Server cache request? If yes is it possible that I could disable this caching behavior?
from functions.netlify.com.
I closed this issue because the function is working after I updated the Javascript library.
from functions.netlify.com.
Related Issues (20)
- [Proposal] Function example for Go MongoDB CRUD that can be locally tested
- fdfdf
- Title
- [Proposal] New functions example
- [security] Enforce Branch Protections
- Function tutorial: Building a Video Chat App with Vuejs and Golang
- questions
- Function example:
- Function tutorial:
- netlify config
- web
- auth
- Function tutorial:
- Update legacy explorers.netlify.com link urls found on functions.netlify.com HOT 1
- @jasti99 we've closed this issue as it was lacking a proper description and a referenced issue. Furthermore it seems that your changelog is los in the void of rebase/merge issues.
- Update the main website page
- Function example:https://verdant-pie-e9549e.netlify.app/
- Add side nav link to Serverless Functions Jamstack Explorers course HOT 2
- Double opt-in newsletters subscriptions with Netlify + Airtable + Vero
- mich
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from functions.netlify.com.