Vue Build Error with Netlify Lambda Functions

Having some trouble building my vue app since adding lambda functions.

Getting the error:
Error: ENOENT: no such file or directory, scandir 'path/to/myapp/src/functions'

Looks like it’s looking inside the ‘src’ folder but my ‘functions’ folder and the ‘lambda’ folder that’s built from those functions are both in the root.

I have a netlify.toml file that looks like

[build]
command = "npm run prod"
functions = "lambda"
publish = "dist"

“npm run prod” runs “npm run build; npm run build:lambda”

Hey @xdagency,
Could you please share a few more details with us so we can take a look: full package.json would be helpful, Netlify URL, and also whether or not you’re using netlify-lambda to build your functions?

Have nearly same issue

package.json:

{ “name”: “imkereibuchhaltung”,
“version”: “0.1.0”,
“private”: true,
“scripts”: {
“serve”: “vue-cli-service serve”,
“build”: “vue-cli-service build”,
“lint”: "vue-cli-service lint },

“dependencies”: {
“core-js”: “^3.6.5”,
“dotenv”: “^8.2.0”,

"vue": "^2.6.11",

"vue-router": "^3.2.0",

"vuetify": "^2.4.0",

"vuex": "^3.4.0"

},

“devDependencies”: {

"@vue/cli-plugin-babel": "~4.5.0",

"@vue/cli-plugin-eslint": "~4.5.0",

"@vue/cli-plugin-router": "~4.5.0",

"@vue/cli-plugin-vuex": "~4.5.0",

"@vue/cli-service": "~4.5.0",

"@vue/eslint-config-prettier": "^6.0.0",

"babel-eslint": "^10.1.0",

"eslint": "^6.7.2",

"eslint-plugin-prettier": "^3.1.3",

"eslint-plugin-vue": "^6.2.2",

"prettier": "^1.19.1",

"sass": "^1.32.0",

"sass-loader": "^10.0.0",

"vue-cli-plugin-netlify-lambda": "~0.1.1",

"vue-cli-plugin-vuetify": "~2.2.2",

"vue-template-compiler": "^2.6.11",

"vuetify-loader": "^1.7.0"

},

“eslintConfig”: {

"root": true,

"env": {

  "node": true

},

"extends": [

  "plugin:vue/essential",

  "eslint:recommended",

  "@vue/prettier"

],

"parserOptions": {

  "parser": "babel-eslint"

},

"rules": {}

},

“browserslist”: [

"> 1%",

"last 2 versions",

"not dead"

]

}

INFO Starting development server…
Starting server
Lambda server is listening on 9000
40% building 11/21 modules 10 active …ive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\eslint-loader\index.js??ref–13-0!C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\src\App.vue U
nhandled rejection Error: Cannot find module ‘C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\lambda\hello’
Require stack:

  • C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\netlify-lambda\lib\serve.js
  • C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\netlify-lambda\bin\cmd.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    at Function.resolve (internal/modules/cjs/helpers.js:78:19)
    at Object.clearCache (C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\netlify-lambda\lib\serve.js:83:36)
    at C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\netlify-lambda\bin\cmd.js:34:16
    at Array.forEach ()
    at Watching.handler (C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\netlify-lambda\bin\cmd.js:33:32)
    at C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\webpack\lib\Watching.js:99:9
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\tapable\lib\HookCodeFactory.js:33:10), :4:1)
    at AsyncSeriesHook.lazyCompileHook (C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\tapable\lib\Hook.js:154:20)
    at Watching._done (C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\webpack\lib\Watching.js:98:28)
    at onCompiled (C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\webpack\lib\Watching.js:48:18)
    at C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\webpack\lib\Compiler.js:681:15
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\tapable\lib\HookCodeFactory.js:33:10), :4:1)
    at AsyncSeriesHook.lazyCompileHook (C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\tapable\lib\Hook.js:154:20)
    at C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\webpack\lib\Compiler.js:678:31
    From previous event:
    at C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\terser-webpack-plugin\dist\TaskRunner.js:109:96
    at Array.forEach ()
    at TaskRunner.run (C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\terser-webpack-plugin\dist\TaskRunner.js:91:11)
    at TerserPlugin.optimizeFn (C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\terser-webpack-plugin\dist\index.js:227:18)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\tapable\lib\HookCodeFactory.js:33:10), :5:1)
    at AsyncSeriesHook.lazyCompileHook (C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\tapable\lib\Hook.js:154:20)
    at C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\webpack\lib\Compilation.js:1409:36
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\tapable\lib\HookCodeFactory.js:33:10), :4:1)
    at AsyncSeriesHook.lazyCompileHook (C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\tapable\lib\Hook.js:154:20)
    at C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\webpack\lib\Compilation.js:1405:32
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\tapable\lib\HookCodeFactory.js:33:10), :4:1)
    at AsyncSeriesHook.lazyCompileHook (C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\tapable\lib\Hook.js:154:20)
    at Compilation.seal (C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\webpack\lib\Compilation.js:1342:27)
    at C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\webpack\lib\Compiler.js:675:18
    at C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\webpack\lib\Compilation.js:1261:4
    at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\tapable\lib\HookCodeFactory.js:33:10), :22:1)
    at AsyncSeriesHook.lazyCompileHook (C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\tapable\lib\Hook.js:154:20)
    at Compilation.finish (C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\webpack\lib\Compilation.js:1253:28)
    at C:\Users\mlues\OneDrive\Dokumente\Entwickler\imkereibuchhaltung\node_modules\webpack\lib\Compiler.js:672:17

98% after emitting CopyPlugin

DONE Compiled successfully in 24838ms 14:47:46

App running at:

The functions-log shows:

2:43:10 PM: 2021-03-06T13:43:10.485Z undefined ERROR Uncaught Exception {“errorType”:“Runtime.UserCodeSyntaxError”,“errorMessage”:“SyntaxError: Unexpected token ‘export’”,“stack”:[“Runtime.UserCodeSyntaxError: SyntaxError: Unexpected token ‘export’”," 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:999:30)"," at Object.Module._extensions…js (internal/modules/cjs/loader.js:1027:10)"," at Module.load (internal/modules/cjs/loader.js:863:32)"," at Function.Module._load (internal/modules/cjs/loader.js:708:14)"," at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)"," at internal/main/run_main_module.js:17:47"]}
2:43:10 PM: 2021-03-06T13:43:10.695Z undefined ERROR Uncaught Exception {“errorType”:“Runtime.UserCodeSyntaxError”,“errorMessage”:“SyntaxError: Unexpected token ‘export’”,“stack”:[“Runtime.UserCodeSyntaxError: SyntaxError: Unexpected token ‘export’”," 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:999:30)"," at Object.Module._extensions…js (internal/modules/cjs/loader.js:1027:10)"," at Module.load (internal/modules/cjs/loader.js:863:32)"," at Function.Module._load (internal/modules/cjs/loader.js:708:14)"," at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)"," at internal/main/run_main_module.js:17:47"]}
2:43:10 PM: Duration: 167.32 ms Memory Usage: 15 MB

2:43:10 PM: Unknown application error occurred
Runtime.UserCodeSyntaxError