Can you paste the code for your script here? I wonder if some of the URLs cause the serverless function to throw an error, which would then make the fetch
fail as well.
Can you paste the code for your script here? I wonder if some of the URLs cause the serverless function to throw an error, which would then make the fetch
fail as well.
Sure, here is the script code:
const table = base.getTable(“Content”);
const query = await table.selectRecordsAsync()
for (let record of query.records) {
const articleUrl = record.getCellValueAsString(“URL”);
const response = await fetch( https://mtgzblpjf0.execute-api.us-east-1.amazonaws.com/dev/hello?url=${articleUrl}
);
const data = await response.json();
console.log(‘articleUrl’, articleUrl);
table.updateRecordAsync(record, {
“Article’s Title”: data.title,
“Article’s Content”: data.text,
});
}
I’m checking if it works with the console.log function.
Sure, here is the script code:
const table = base.getTable(“Content”);
const query = await table.selectRecordsAsync()
for (let record of query.records) {
const articleUrl = record.getCellValueAsString(“URL”);
const response = await fetch( https://mtgzblpjf0.execute-api.us-east-1.amazonaws.com/dev/hello?url=${articleUrl}
);
const data = await response.json();
console.log(‘articleUrl’, articleUrl);
table.updateRecordAsync(record, {
“Article’s Title”: data.title,
“Article’s Content”: data.text,
});
}
I’m checking if it works with the console.log function.
In the examples, fetch
uses the config option cors: true,
, so maybe try that. There’s also some config on Amazon to enable CORS.
The intermittent Failed to fetch
error suggests that sometimes your serverless function is failing to return a valid response.
When this happens, you can debug it by looking at the Network panel of the browser’s developer tools.
The intermittent Failed to fetch
error suggests that sometimes your serverless function is failing to return a valid response.
When this happens, you can debug it by looking at the Network panel of the browser’s developer tools.
Thanks! I modified the serverless function a bit and it runs well now. It just have a problem with the youtube links, but that is a different topic