SyntaxError: Unexpected token 'export'

Hi, I am having trouble deploying my express app to netlify as serverless function. I converted my code to commonjs syntax. However, it is still throwing error

Runtime.UserCodeSyntaxError: SyntaxError: Unexpected token 'export'
    at _loadUserApp (file:///var/runtime/index.mjs:1084:17)
    at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1119:21)
    at async start (file:///var/runtime/index.mjs:1282:23)
    at async file:///var/runtime/index.mjs:1288:1

I cant seem to understand what is going on.

This is my repo link under feature/serverless branch

Do appreciate your help

This repository is either non-existent or set to private.

Apologies, I have set to public.

hi @josephkohhh

Can you please also share a link to the deploy that’s not working fine? is that error being thrown at runtime or buildtime?

1 Like