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

Getting Required dependency file not found #3615

Closed
5 tasks done
arturkasperek opened this issue Jul 25, 2023 · 10 comments
Closed
5 tasks done

Getting Required dependency file not found #3615

arturkasperek opened this issue Jul 25, 2023 · 10 comments
Assignees
Labels
archived This issue has been locked. compute usability

Comments

@arturkasperek
Copy link

arturkasperek commented Jul 25, 2023

Before opening, please confirm:

  • I have checked to see if my question is addressed in the FAQ.
  • I have searched for duplicate or closed issues.
  • I have read the guide for submitting bug reports.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.

App Id

d1jlh2fb5j9l38

AWS Region

us-east-1

Amplify Hosting feature

SSR

Frontend framework

Next.js

Next.js version

13.3.1

Next.js router

App Router

Describe the bug

2023-07-25T08:16:18.184Z [INFO]: # Starting phase: preBuild
# Executing command: echo "Skip pre build - already handled"
Skip pre build - already handled
# Completed phase: preBuild
# Starting phase: build
# Executing command: echo "Skip build - already handled"
Skip build - already handled
# Completed phase: build
2023-07-25T08:16:18.186Z [INFO]: ## Build completed successfully
2023-07-25T08:16:18.188Z [INFO]: Setting NEXT_PRIVATE_STANDALONE=true to produce .next/standalone directory
2023-07-25T08:16:18.190Z [INFO]: # No custom headers found.
2023-07-25T08:16:19.563Z [ERROR]: !!! CustomerError: Required dependency file not found: /codebuild/output/src1141702021/src/amplify-deployment/node_modules/webpack/lib/ModuleFilenameHelpers.js
2023-07-25T08:16:19.563Z [INFO]: # Starting environment caching...
2023-07-25T08:16:19.564Z [INFO]: # Environment caching completed
Terminating logging...

Expected behavior

Amplify shouldn't expect for existence of webpack related stuff once build finished

Reproduction steps

  1. Push on the CodeCommit a .next folder with already build artifacts + amplify.yml + package.json
  2. Trigger a new build and notice the problem

Build Settings

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - echo "Skip pre build - already handled"
    build:
      commands:
        - echo "Skip build - already handled"
  artifacts:
    baseDirectory: .next
    files:
      - '**/*'

Log output

2023-07-25T08:16:18.184Z [INFO]: # Starting phase: preBuild
                                 # Executing command: echo "Skip pre build - already handled"
                                 Skip pre build - already handled
                                 # Completed phase: preBuild
                                 # Starting phase: build
                                 # Executing command: echo "Skip build - already handled"
                                 Skip build - already handled
                                 # Completed phase: build
2023-07-25T08:16:18.186Z [INFO]: ## Build completed successfully
2023-07-25T08:16:18.188Z [INFO]: Setting NEXT_PRIVATE_STANDALONE=true to produce .next/standalone directory
2023-07-25T08:16:18.190Z [INFO]: # No custom headers found.
2023-07-25T08:16:19.563Z [ERROR]: !!! CustomerError: Required dependency file not found: /codebuild/output/src1141702021/src/amplify-deployment/node_modules/webpack/lib/ModuleFilenameHelpers.js
2023-07-25T08:16:19.563Z [INFO]: # Starting environment caching...
2023-07-25T08:16:19.564Z [INFO]: # Environment caching completed
Terminating logging...

Additional information

1 day ago everything worked fine and amplify didn't complain about missing things inside node_modules. I don't sure what happened under the hood

@arturkasperek
Copy link
Author

Now I made a tweak to include node_modules and I see the following error:

                                 # Starting phase: preBuild
2023-07-25T09:13:40.003Z [INFO]: # Executing command: echo "Skip pre build - already handled"
                                 Skip pre build - already handled
                                 # Completed phase: preBuild
                                 # Starting phase: build
                                 # Executing command: echo "Skip build - already handled"
                                 Skip build - already handled
                                 # Completed phase: build
2023-07-25T09:13:40.005Z [INFO]: ## Build completed successfully
2023-07-25T09:13:40.007Z [INFO]: Setting NEXT_PRIVATE_STANDALONE=true to produce .next/standalone directory
2023-07-25T09:13:40.008Z [INFO]: # No custom headers found.
2023-07-25T09:13:42.149Z [ERROR]: !!! CustomerError: Required dependency file not found: /codebuild/output/src3013346407/src/amplify-deployment/src/components/languages/cn.json
2023-07-25T09:13:42.150Z [INFO]: # Starting environment caching...
2023-07-25T09:13:42.150Z [INFO]: # Environment caching completed
Terminating logging...

It seems to amplify is using a different relative path - I think it should use .next/standalone as a base dir

@arturkasperek
Copy link
Author

arturkasperek commented Jul 25, 2023

cc @ferdingler
Now I made as well test build where .next/standalone folder doesn't exist and a build passed.
Something like that wasn't possible in the past #3132 ...

@ferdingler
Copy link
Contributor

@arturkasperek I'm sorry you ran into an issue.

For background
We indeed made a change internally to stop relying on the standalone mode from Next.js for several reasons, for example, it doesn't work with certain Monorepo frameworks, and there has been regressions introduced by the Next.js team to the standalone mode that end up affecting our customers.

The standalone mode was a convenient way to generate a trimmed down version of the node_modules folder that contains only the necessary dependencies used at runtime, and nothing else. But now we are building this folder ourselves by reading the contents of the *.nft.json files produced by Next.js.

About your issue:
It sounds like you are providing the .next/standalone folder by itself as the build artifact, as opposed to providing the raw .next folder?

@arturkasperek
Copy link
Author

arturkasperek commented Jul 26, 2023

@ferdingler I will figure out something - next time you should send some info prior to change.

In my company, we have our own internal CI/CD and to amplify we provide an already build .next folder.

I think you should prepare some documentation what folders/files should be provided once build finish on the amplify

@tsvint
Copy link

tsvint commented Aug 3, 2023

2023-08-03T11:45:08.761Z [INFO]: # Completed phase: build
2023-08-03T11:45:08.763Z [INFO]: ## Build completed successfully
2023-08-03T11:45:08.764Z [INFO]: # Starting caching...
2023-08-03T11:45:08.774Z [INFO]: # Creating cache artifact...
2023-08-03T11:45:18.010Z [INFO]: # Created cache artifact
2023-08-03T11:45:18.109Z [INFO]: # Uploading cache artifact...
2023-08-03T11:45:22.677Z [INFO]: # Uploaded cache artifact
2023-08-03T11:45:22.762Z [INFO]: # Caching completed
2023-08-03T11:45:22.766Z [INFO]: Setting NEXT_PRIVATE_STANDALONE=true to produce .next/standalone directory
2023-08-03T11:45:22.769Z [INFO]: # No custom headers found.
2023-08-03T11:45:26.448Z [ERROR]: !!! CustomerError: Required dependency file not found: /codebuild/output/src2958333560/src/tsv-webapp/amplify.sh
2023-08-03T11:45:26.548Z [INFO]: # Starting environment caching...
2023-08-03T11:45:26.548Z [INFO]: # Environment caching completed
Terminating logging...

Facing the same issue, we are not able to deploy new nextjs apps to amplify - and cannot do any new releases.

@sudhishkr
Copy link

+1 ^ hitting similar issue. I have left my notes on #3631

@sudhishkr
Copy link

+1 ^ hitting similar issue. I have left my notes on #3631

#3615 (comment)

@Jay2113 Jay2113 self-assigned this Aug 10, 2023
@Jay2113
Copy link
Contributor

Jay2113 commented Aug 10, 2023

@arturkasperek Thanks for sharing your use case and feedback here. I am going to relay this to the team internally.

@tsvint @sudhishkr We have deployed a fix for the missing amplify.sh as stated here: #3631 (comment).

@Jay2113 Jay2113 closed this as completed Aug 10, 2023
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

@github-actions
Copy link

This issue has been automatically locked.

@github-actions github-actions bot added the archived This issue has been locked. label Aug 10, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Aug 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived This issue has been locked. compute usability
Projects
None yet
Development

No branches or pull requests

5 participants