question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deploy with `build: false` doesn't work

See original GitHub issue

Describe the bug

Running sls with build vs running sls with manual build do not yield the same result.

This is my config WITH specified build:

# serverless.yml
distDir: ''

my-app:
  component: "@sls-next/serverless-component@1.19"
  inputs:
    nextConfigDir: ${distDir}
    build:
      cmd: "nx"
      args: ["run", "desktop:build:production"]
      cwd: "../../"

This is config WITHOUT build:

# serverless.yml
distDir: ''

my-app:
  component: "@sls-next/serverless-component@1.19"
  inputs:
    nextConfigDir: ${distDir}
    build: false

Actual behavior

When I run that nx run desktop:build:production I do not get .serverless_nextjs folder in my dist. Then when I run sls to deploy I get:

Error: ENOENT: no such file or directory, open 'absolute-path-to-dist/.serverless_nextjs/default-lambda/manifest.js

Expected behavior

Running sls to deploy with build: false after manually building should result in correct deploy.

Steps to reproduce

Just follow bug description.

Screenshots/Code/Logs

Versions

Additional context

I have searched through the source code and found out that build operation actually passes that folder name to Builder: https://github.com/serverless-nextjs/serverless-next.js/blob/41b6be1943bca70a1e2e6f919b5ee6fecc56389f/packages/serverless-components/nextjs-component/src/component.ts#L219

Then it is latter used as buildDir https://github.com/serverless-nextjs/serverless-next.js/blob/41b6be1943bca70a1e2e6f919b5ee6fecc56389f/packages/libs/lambda-at-edge/src/build.ts#L72

This is all I could find. There is a lot going on that file, and I am not that proficient in serverless DevOps stuff to understand it.

Checklist

  • You have reviewed the README and FAQs, which answers several common questions.
  • Please first try using the most recent latest or alpha @sls-next/serverless-component release version, which may have already fixed your issue or implemented the feature you are trying to use. Note that the old serverless-next.js component and the serverless-next.js plugin are deprecated and no longer maintained.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:21

github_iconTop GitHub Comments

2reactions
dphangcommented, Jun 25, 2021

Not yet, I will release it soon. There were a couple regressions in the latest alphas which were fixed so I think it can be released.

Now that e2e tests are a bit more complete/stable I think we can go for a faster release cycle

1reaction
dphangcommented, Jun 21, 2021

@Bielik20 ah, that makes sense now, I think it was there before I started on this project, it might be to ensure a clean state before trying to build. But I guess any build commands (whether Next.js’s or custom ones) should handle the cleanup instead of this component? It looks like just a one line removal if so

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build troubleshooting tips
This article provides troubleshooting tips for failing builds in Netlify's build service. In case your build fails on Netlify, first make sure it...
Read more >
Build errors during deployment to GitHub Pages · Issue #209
I am failed to deploy the ai-folio theme in my personal repository. Even I don't find any fruitful reason why it is happening....
Read more >
Build works successfully, but the build definition does not ...
Hey everyone, I am setting up automatic builds and I'm trying to attach a deployment process to the build definition.
Read more >
How to prevent Netlify from treating warnings as errors ...
You need to have CI to be false during your build command. Go to: https://app.netlify.com/sites/mysales-krohne/settings/deploys > Build ...
Read more >
Troubleshooting Node.js Deploys
Your Node.js deploy failed - now what? Start with these simple steps to troubleshoot a build issue. Check the buildpack.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found