NextJs manual deploy not working. Neither API deploy

Hello everyone,

I am trying to deploy an entire Next.js site using the Netlify API. Here is the link to the site: https://created-from-api.netlify.app/.

I have been debugging with manual deployments to determine which folders and files I need to pass to the API, but I haven’t been able to get it working, either manually or with the API. I always encounter the “Page Not Found” view.

One strange thing I cannot understand is that if I deploy the site using netlify-cli and then download the generated ZIP file from the Deploys Dashboard, when I upload that exact ZIP file to a new “manual deploy,” the site does not work.

In summary, I am running:

  • npm run build
  • And uploading the .next folder into the manual deploy.

The output I get is: PAGE NOT FOUND.

The netlify-cli deploy seems to work, although the CSS is not functioning, but that may be a separate issue.

Important Note: Initially, I was trying to upload a Next.js project that was inside another Next.js project. I had my root Next.js project, and inside it, a folder /templates/one, which contained another Next.js project. However, the tests I’m conducting are with a simple Next.js folder (nothing inside anything).

I feel like I might be missing something in my understanding. Any help would be greatly appreciated!

Side notes:

this is my netlify.toml

[build]
  command = "npm run build"
  publish = ".next"

[[plugins]]
  package = "@netlify/plugin-nextjs"

My next.config

/** @type {import('next').NextConfig} */
const nextConfig = {
  swcMinify: true,
  reactStrictMode: false,
};

module.exports = nextConfig;

This is expected. You need to use the CLI and deploy using netlify deploy --build.

So i dont have any chance of deploying a nextjs by using the api or a manual deploy ?

SInce i read this, i thought it was possible

The solution is to make the deploy running:
netlify deploy --build

Instead of
netlify build && netlify deploy