Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deploy to netlify using github actions #13777

Closed
anburocky3 opened this issue Apr 19, 2022 · 12 comments
Closed

deploy to netlify using github actions #13777

anburocky3 opened this issue Apr 19, 2022 · 12 comments

Comments

@anburocky3
Copy link

Describe the bug

While fetching the data from the github repo, it is working good, but if i make my own github action with all required information, it is not building nuxt3 dist folder.

As per nuxt3 netlify docs: https://v3.nuxtjs.org/guide/deployment/netlify

It is not detecting the netlify environment while building.

Steps to reproduce

  1. Run git clone https://github.com/anburocky3/iragugal-web
  2. Check the github actions: .github/workflows/netlify.yaml & netlify.toml file
  3. Try to push it and the action fails with this error message.

image

Configuration

[dev]
  command = "sleep 999999999"
  framework = "#custom"
  functions = ".output/server"
  port = 8888
  targetPort = 3000

[build]
  command = "yarn build"
  publish = "dist/"
  functions = ".output/server"

[[redirects]]
  from = "/*"
  to = "/.netlify/functions/index"
  status = 200

Environment

  System:
    OS: Windows 10 10.0.22598
    CPU: (32) x64 AMD Ryzen 9 3950X 16-Core Processor
    Memory: 20.23 GB / 31.92 GB
  Binaries:
    Node: 16.14.2 - S:\laragon\bin\nodejs\node-v16.14.2-win-x64\node.EXE
    Yarn: 3.2.0 - S:\laragon\bin\nodejs\node-v16.14.2-win-x64\yarn.CMD
    npm: 8.5.0 - S:\laragon\bin\nodejs\node-v16.14.2-win-x64\npm.CMD
  npmPackages:
    netlify-cli: ^10.0.0 => 10.0.0

Have created this issue with nitro-deploys: unjs/nitro-deploys#9 (Feel free to close, if it is repetative)

@pi0
Copy link
Member

pi0 commented Apr 19, 2022

Hi @anburocky3. It is strange why you are using Github actions to deploy netlify? Preset is designed to work with their CI/CD.

@anburocky3
Copy link
Author

Hi @anburocky3. It is strange why you are using Github actions to deploy netlify? Preset is designed to work with their CI/CD.

Basically, it's my hobby site, and I will push many commits to it. Netlify only provides 300minutes as build time. Since I'm building multiple sites with netlify, 300minutes is not at all enough.

So thought github actions provides 2000minutes/month, which is great. So thought, making it github actions friendly would be good.

Why is that, difficult to implement nitro with github-actions?

@pi0 pi0 changed the title Not creating dist folder on nuxt3 project using github actions. deploy to netlify using github actions Apr 19, 2022
@pi0
Copy link
Member

pi0 commented Apr 19, 2022

I see. Thanks for explaining. No, it shouldn't be difficult just never tried it....

In your reproduction (https://github.com/anburocky3/iragugal-web/blob/main/.github/workflows/netlify.yml), can you please try adding NITRO_PRESET: 'netlify'?

@anburocky3
Copy link
Author

NITRO_PRESET: 'netlify'

Great, now it is creating in dist folder, but do we need to specify any functions like .netlify/functions-internal as mentioned here: https://github.com/unjs/nitro/blob/main/src/presets/netlify.ts#L10 and also, how to setup entry file to server.ts?

@anburocky3
Copy link
Author

@pi0 Please check this log: https://github.com/anburocky3/iragugal-web/runs/6085860828?check_suite_focus=true (Build is successful, but 404 page)

Do i need to have my functions anywhere?

@mklueh
Copy link

mklueh commented May 8, 2022

Hi @anburocky3. It is strange why you are using Github actions to deploy netlify? Preset is designed to work with their CI/CD.

@pi0 Just found this thread and your post and I might have an issue that is related.

I'm using NX to build and deploy multiple sites out of one monorepo, using the Netlify CLI and the Netlify Edge preset, but strangely all I'm getting after the deployment is 404 errors.

I've tried multiple directories in the deploy command inside my application's subdirectory:

  1. None
  2. "."
  3. ".output"
  4. ".output/public"

The last one is the only one not leading to 404, but then everything that is related to functions is obviously missing.

Reading your comment, I'm wondering if the preset stuff really only works with Netlify builds and if so, is there any workaround to get the server part generated by Nuxt deployed easily?

Maybe, this should be made clear in the docsas well if it isn't already :)

@mklueh
Copy link

mklueh commented Jun 26, 2022

@anburocky3 curious, have you already found a solution?

@anburocky3
Copy link
Author

@anburocky3 curious, have you already found a solution?

Sadly no. Looking for an solution.

@mklueh
Copy link

mklueh commented Jun 27, 2022

@anburocky3 maybe this helps you somehow. Still facing some issues but at least I get an netlify directory with a zip archive locally https://github.com/nuxt/framework/discussions/1799#discussioncomment-2977400

@gurvancampion
Copy link

gurvancampion commented Oct 18, 2022

It worked for me using Netlify CLI, here is my workflow:
https://github.com/gurvan-guss/turborepo-nuxt-boilerplate/blob/main/.github/workflows/ci.yaml#L128
You can check out the repository as well, it's a monorepo containing Nuxt, Vitepress & Histoire and deployed to netlify

@issue-up
Copy link

issue-up bot commented Mar 1, 2023

Upstream issue created:

@atinux
Copy link
Member

atinux commented Apr 10, 2024

Closing as @gurvancampion solution seems good

@atinux atinux closed this as completed Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants