Nextjs github actions deployment to netlify

Hello, I would like to deploy a Nextjs website (called enchanting-elf-d42f40 on netlify) using the CLI, through GitHub actions but for now, I’m still getting this error when I want to access it:

Page Not Found : Looks like you’ve followed a broken link or entered a URL that doesn’t exist on this site.

To do this I’m creating a new site on the netlify UI, linking it to my GitHub repository, but afterward, I’m disabling the builds since I want them to be triggered through the CLI.
My netlify.toml :

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

package = "@netlify/plugin-nextjs"

My production.yml :

name: Build & Deploy to Netlify
- master
types: [labeled, opened, synchronize, reopened]
if: "!contains(github.event.head_commit.message, 'ci skip')"
runs-on: ubuntu-latest
- uses: actions/checkout@v3
- name: Use Node.js version from package.json
uses: actions/setup-node@v3
node-version-file: 'package.json'
- name: Npm install
run: npm ci
- name: Build
run: npm run build
- name: Deploy to Netlify
uses: netlify/actions/cli@master
args: deploy --prod

No functions are created on the deployment logs on the netlify UI, there are only files that are uploaded. I also tested the —build option for the CLI but it changed nothing.

Example with no CLI deploy, the build is done through netlify UI on another site (everything works):

Example with the CLI (code above) :

Any help would be appreciated, thanks in advance.

Hi @software,

Thanks for reaching out!

Have you seen this section from the GitHub for the next.js runtime:


If you build on Netlify, the Next.js Runtime will work with no additional configuration. However if you are building and deploying locally using the Netlify CLI, you must deploy using netlify deploy --build. Running the build and deploy commands separately will not work, because the Next.js Runtime will not generate the required configuration.

I also found this blog post that may help:

Let us know if you have any questions.