-
-
Notifications
You must be signed in to change notification settings - Fork 451
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
NX Monorepo support #1845
Comments
I'm not familiar with Nx Monorepo but could you clarify what specifically does not work? I believe you should be able to use inputs like |
We are using this in an Nx monorepo. What kind of issue are you experiencing? |
Hello, i'm using NX and have set build = false but serverless is expecting that file. How does this file gets created .serverless_nextjs\default-lambda\manifest.json? I'm getting an error because that file does not exists in the build output folder created by NX. @Oldbury were you able to deploy? |
I have it working like this (the app is named "client"): in worskpace.json, I have this configuration:
The important part is the production output path - I'm sending it to a deploy folder inside the app root. Next, in apps/client/deploy, I have a serverless.yml file
In the same deploy folder, I have a file build.sh
In the client app root, my next.config.js file looks like this:
And finally, to deploy, I run the following:
(actually, my setup is a little bit more complex because I deploy to multiple environments, but this is how it would be done for single environment deployments) |
@estyh thanks for the detailed explanation, I really appreciate it, that gave me some directions. I end up serverless.yml
workspace.json
|
@wguerram
@estyh Did you run into a artifact size issue when deploying using your method? |
@Rafcin no |
Just me then. Your serverless method is also way better @estyh!! Odd it seems I'm the only one who can't deploy a proper build. |
I am also running into this issue. We are trying to convert our project into an nx monorepo, and it keeps failing on the Specifically, this fails:
Further down:
It assumes that the Maybe I am configuring things the wrong way around, but everything else seems to work fine (the build step goes through no problem). It's just when it hits the Any advice/help is greatly appreciated. |
Small update to @estyh script for this to work with Next 13 since see:
Renaming the
current config some-app:
component: "@sls-next/serverless-component@3.7.0"
inputs:
build:
cmd: "./build.sh"
args:
- some-app
useServerlessTraceTarget: true #!/bin/bash
set -eoux pipefail
app=$1
rm -rf .next
project_root="$(git rev-parse --show-toplevel)"
deploy_dir=${project_root}/apps/${app}/deploy
dist_dir=${deploy_dir}/.next
cd "${project_root}"
nx run "${app}":build:production
mv "${dist_dir}"/server "${dist_dir}"/serverless edit: I also use the patched serverless version
|
can someone share a workable example for this? |
Nx Monorepo Support
Would be good to support using this component as part of a Monorepo.
I'm building an app with NextJS as part of an NX Monorepo and want to use the Serverless next component to deploy the app and functions as I have done in previous projects
The text was updated successfully, but these errors were encountered: