tested both locally and on ec2
tested using fetch and using axios
tested using dummy REST testing url, as well as AWS api gateway endpoint
tested using both the simple and the advanced sample for zoom app
result in the same type of error: Fetch Error: Failed to fetch
For axios it is some corresponding
To reproduce, setup simple sample app as instructed, then modify public/js/index.js to become
// import App from './App';
(async () => {
try {
const configResponse = await zoomSdk.config({
size: { width: 480, height: 360 },
capabilities: [
/* Add Capabilities Here */
'shareApp',
],
});
console.debug('Zoom JS SDK Configuration', configResponse);
} catch (e) {
console.error(e);
const errorDiv = document.getElementById('fetchError');
if (errorDiv) {
errorDiv.textContent = `Configuration Error: ${e.message}`;
}
}
// test fetch
try {
// load face image from local file
const faceImage = new File([], 'face.jpg', { type: 'image/jpeg' });
const response = await fetch('https://v8c6qwk16b.execute-api.us-east-1.amazonaws.com/default/RetrieveUserByFace', {
method: 'POST',
body: faceImage,
});
const responseData = await response.json();
console.log(responseData);
const responseDiv = document.getElementById('fetchResponse');
if (responseDiv) {
responseDiv.textContent = JSON.stringify(responseData, null, 2);
}
} catch (error) {
console.error('Fetch error:', error);
const errorDiv = document.getElementById('fetchError');
if (errorDiv) {
errorDiv.textContent = `Fetch Error: ${error.message}`;
}
}
})();
also modify server\views\index.pug:
extends layout
block content
h1=title
if isZoom
p Welcome to your Zoom App
#fetchResponse.response-container
#fetchError.error-container
else
p You're viewing your Zoom App through the browser.
a(href=`/install`) Click Here
| to install your app in Zoom.
append scripts
if isZoom
script(type="module" src='/js/bundle.mjs')
script(nomodule src='/js/bundle.js')