I have uploaded a js function to the /functions folder of my GitHub pages site:
const functionA = () => {
console.log('HI EVERYONE!!');
var rng_nums = new Uint32Array(2);
if (window.crypto && window.crypto.getRandomValues)
window.crypto.getRandomValues(rng_nums);
// Chrome, Opera, Firefox
else if (window.msCrypto && window.msCrypto.getRandomValues)
window.msCrypto.getRandomValues(rng_nums);
// IE
else
rng_nums = [
Math.floor(Math.random() * 4294967295),
Math.floor(Math.random() * 4294967295),
]; // All outdated browsers
return (rng_nums[0] >>> 5) * 67108864.0 + (rng_nums[1] >>> 6);
};
I have set up functions in my Netlify settings and it says 1 Lambda function actively running in production .
When I try and call it from a locally run create-react-app for testing, I get a error 502.
<button
onClick={() => {
const cors = `https://cors-anywhere.herokuapp.com/`;
axios
.get(
`${cors}https://rickgove.netlify.app/.netlify/functions/functionA`
)
.then(res => {
console.log('Success');
console.log(res);
})
.catch(err => {
console.log('Error');
console.log(err);
});
}}
>
Generate Random on Server
</button>
What am I doing wrong?