FUNCTION_INVOCATION_FAILED error when deploying Nuxt SSR
See original GitHub issueIm trying to deploy my Nuxt app on Vercel and I am getting this error:
500: INTERNAL_SERVER_ERROR
Code: FUNCTION_INVOCATION_FAILED
ID: cdg1::8wqzr-1615828714544-46008e53fb6d
The log I get in vercel:
[GET] /
20:25:18:57
2021-03-15T17:25:18.880Z undefined ERROR Uncaught Exception {"errorType":"Error","errorMessage":"Could not load Nuxt configuration. Make sure all dependencies are listed in package.json dependencies or in serverFiles within builder options:\n Error: Cannot find module 'esm'\nRequire stack:\n- /var/task/vercel__launcher.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js","stack":["Error: Could not load Nuxt configuration. Make sure all dependencies are listed in package.json dependencies or in serverFiles within builder options:"," Error: Cannot find module 'esm'","Require stack:","- /var/task/vercel__launcher.js","- /var/runtime/UserFunction.js","- /var/runtime/index.js"," at Object.<anonymous> (/var/task/vercel__launcher.js:23:13)"," at Module._compile (internal/modules/cjs/loader.js:1063:30)"," at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)"," at Module.load (internal/modules/cjs/loader.js:928:32)"," at Function.Module._load (internal/modules/cjs/loader.js:769:14)"," at Module.require (internal/modules/cjs/loader.js:952:19)"," at require (internal/modules/cjs/helpers.js:88:18)"," at _tryRequire (/var/runtime/UserFunction.js:75:12)"," at _loadUserApp (/var/runtime/UserFunction.js:95:12)"," at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)"]}
Unknown application error occurred
Error
Here’s the link to my website: https://med-guide-c72ux6hw0-bilendm.vercel.app/
Here’s my vercel.json file:
"version": 2,
"builds": [
{
"src": "nuxt.config.js",
"use": "@nuxtjs/vercel-builder",
"config": {}
}
]
}
Here’s my package.json:
{
"name": "med-guide",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate",
"lint:js": "eslint --ext \".js,.vue\" --ignore-path .gitignore .",
"lint": "yarn lint:js"
},
"dependencies": {
"@nuxtjs/axios": "^5.12.5",
"core-js": "^3.8.3",
"nuxt": "^2.15.3",
"swiper": "^6.4.15",
"vue-awesome-swiper": "^4.1.1"
},
"devDependencies": {
"@nuxtjs/eslint-config": "^5.0.0",
"@nuxtjs/eslint-module": "^3.0.2",
"@nuxtjs/vuetify": "^1.11.3",
"babel-eslint": "^10.1.0",
"eslint": "^7.18.0",
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-nuxt": "^2.0.0",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-vue": "^7.5.0",
"prettier": "^2.2.1"
}
}
And my nuxt.config.js
import colors from 'vuetify/es5/util/colors'
export default {
// Target: https://go.nuxtjs.dev/config-target
target: 'static',
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
titleTemplate: '%s - med-guide',
title: 'med-guide',
htmlAttrs: {
lang: 'en',
},
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: '' },
],
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: [],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [{ src: '@/plugins/vue-awesome-swiper', mode: 'client' }],
// Auto import components: https://go.nuxtjs.dev/config-components
components: true,
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
// https://go.nuxtjs.dev/eslint
'@nuxtjs/eslint-module',
// https://go.nuxtjs.dev/vuetify
'@nuxtjs/vuetify',
],
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
// https://go.nuxtjs.dev/axios
'@nuxtjs/axios',
],
// Axios module configuration: https://go.nuxtjs.dev/config-axios
axios: {},
// Vuetify module configuration: https://go.nuxtjs.dev/config-vuetify
vuetify: {
customVariables: ['~/assets/variables.scss'],
theme: {
dark: false,
themes: {
light: {
primary: '#00C0D6', // MED-GUIDE-BLUE
accent: '#383838', // MED-GUIDE-TEXT
secondary: '#FF9500', // MED-GUIDE-ORANGE
info: colors.teal.lighten1,
warning: colors.amber.base,
error: colors.deepOrange.accent4,
success: colors.green.accent3,
},
dark: {
primary: colors.blue.darken2,
accent: colors.grey.darken3,
secondary: colors.amber.darken3,
info: colors.teal.lighten1,
warning: colors.amber.base,
error: colors.deepOrange.accent4,
success: colors.green.accent3,
},
},
},
},
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {},
}
I don’t know how to debug this issue 😦
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
FUNCTION_INVOCATION_FAIL...
I am getting the same error when trying to deploy an SSR nuxt project using vercel.json and @nuxt/vercel-builder.
Read more >Commands and Deployment - Nuxt
You should have these commands in your package.json : ... To deploy a SSR application we use target: 'server' , where server is...
Read more >FUNCTION_INVOCATION_FAIL...
Coding example for the question FUNCTION_INVOCATION_FAILED error on Vercel and Nuxt deployment-Vue.js.
Read more >How to Deploy Nuxt.js to Heroku - Vue School
Heroku is an easy and affordable service that we can use to host our Nuxt applications. In this lesson, we'll learn how to...
Read more >How to deploy Nuxt application to server. Production mode on.
Nuxt application deployment, Deploy production ready app. Run Nuxt application in 5 minutes just following simple steps. Configure Nuxt for deployment.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@BilendM Looks like you need vuetify in your dependencies, not devDependencies.
@danielroe Ahhh so anything that is imported in nuxt.config must be inside of dependencies instead of devDependencies? That makes sense. Thank you so much! I will close the issue now 😁