Nuxt.js Internal Server Error
I get Nuxt.js Internal Server Error when I try to visit the site.
now.json:
{
"version": 2,
"builds": [
{
"src": "api/**/*.js",
"use": "@now/node"
},
{
"src": "nuxt.config.js",
"use": "@nuxtjs/now-builder",
"config": {
"serverFiles": ["api/**"]
}
}
],
"routes": [
{ "src": "/api/(.*)", "dest": "api/index.js" },
{ "src": "/api", "dest": "api/index.js" },
{ "src": "/(.*)", "dest": "$1" }
]
}
nuxt.config.js:
export default {
/*
** Nuxt rendering mode
** See https://nuxtjs.org/api/configuration-mode
*/
mode: 'universal',
/*
** Nuxt target
** See https://nuxtjs.org/api/configuration-target
*/
target: 'server',
/*
** Headers of the page
** See https://nuxtjs.org/api/configuration-head
*/
serverMiddleware: ['~/api/index.js'],
env: {
baseUrl: process.env.BASE_URL || 'http://localhost:3000',
},
head: {
title: process.env.npm_package_name || '',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{
hid: 'description',
name: 'description',
content: process.env.npm_package_description || '',
},
],
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
},
/*
** Global CSS
*/
css: ['iview/dist/styles/iview.css'],
/*
** Plugins to load before mounting the App
** https://nuxtjs.org/guide/plugins
*/
plugins: ['@/plugins/iview'],
/*
** Auto import components
** See https://nuxtjs.org/api/configuration-components
*/
components: true,
/*
** Nuxt.js dev-modules
*/
buildModules: [],
/*
** Nuxt.js modules
*/
modules: [],
/*
** Build configuration
** See https://nuxtjs.org/api/configuration-build/
*/
build: {},
}
What's the error?
The error is Nuxt.js Internal Server Error. Functions are internally awaiting new requests
On Sat, Aug 22, 2020, 10:20 PM Dawid Stefaniak [email protected] wrote:
What's the error?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nuxt/vercel-builder/issues/332#issuecomment-678646849, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALOI4XZULQQCZDHWI5Z3CP3SB7H3ZANCNFSM4QIDU46A .
@WaldemarKarasik It's really impossible to tell as this is an issue within your code, not your configuration. However I suspect you might be trying to connect to your serverMiddleware API on server side, which will not work in a serverless environment.
I don't quite understand what you mean by "trying to connect to your serverMiddleware API on server side". I make requests to my api in asyncData and nuxtServerInit, is that the issue?