Hi,
I am in the process of deploying my new website to Netlify but having some issues with getting a function to correctly execute when deployed.
Currently I get a 502 error when the function is deployed to Netlify, locally it executes fine with no errors and returns all the correct data. When I visit the URL of the function in my browser I am greeted with the below error:
{“errorType”:“Runtime.UserCodeSyntaxError”,“errorMessage”:“SyntaxError: Unexpected token ‘.’”,“trace”:[“Runtime.UserCodeSyntaxError: SyntaxError: Unexpected token ‘.’”," at _loadUserApp (/var/runtime/UserFunction.js:98:13)“,” at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)“,” at Object. (/var/runtime/index.js:43:30)“,” at Module._compile (internal/modules/cjs/loader.js:1015:30)“,” at Object.Module._extensions…js (internal/modules/cjs/loader.js:1035:10)“,” at Module.load (internal/modules/cjs/loader.js:879:32)“,” at Function.Module._load (internal/modules/cjs/loader.js:724:14)“,” at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)“,” at internal/main/run_main_module.js:17:47"]}
The function I’m having issues with is my ‘twitter’ function which is deployed @ my website
I also have a second function (‘emailSignup’) which executes fine.
You can view the code for both functions @ my GitHub
I have tried various solutions from the forums but haven’t had any luck so far. Below is a couple of the links I’ve tried:
I did have some issues deploying the site due to the node version on the Netlify deploy being different to my local version of node. I have since set the env vars on Netlify to use the same version of node I’m using locally (v14.15.1) and now the site deploys fine but just this one function doesn’t work.
Any help is greatly appreciated.
Thank you,