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

!!! CustomerError: Can't find required-server-files.json in build output directory #3869

Open
Quska45 opened this issue Dec 21, 2023 · 12 comments
Labels
question Further information is requested

Comments

@Quska45
Copy link

Quska45 commented Dec 21, 2023

No description provided.

@Quska45 Quska45 added the question Further information is requested label Dec 21, 2023
@alexandersg2
Copy link

alexandersg2 commented Dec 22, 2023

I've also been experiencing the error "CustomerError: Can't find required-server-files.json in build output directory" for the past week on my Nextjs app. It doesn't seem to be related to any changes I've made, as I've sometimes been able to revert and then re-add commits to achieve a successful build, only to run into the same issue a few commits later.

This is now completely blocking my deployments.

@rayedturbine
Copy link

Same issue here, Any response yet from Amplify team?

@alexandersg2
Copy link

Any updates on this? I've been unable to deploy new code for 2 weeks now and am getting desperate. If the Amplify team can't look into this, can anyone tell me the next best way to deploy an Amplify app? Cheers

@alexandersg2
Copy link

I seem to have fixed the issue by updating the line **/*.js to src/**/*.js in my tsconfig.json.

@abe123442
Copy link

I am also getting this problem. The solution to update **/*.js to src/**/*.js did not work for me. Can Amplify team look into this?

@karpolan
Copy link

Got the same error after successful build of Next.js application :)

I use Next.js v14 with { output: "export" } config.

I run on custom build image with Node 20: public.ecr.aws/docker/library/node:20.11.0

@rayedturbine
Copy link

rayedturbine commented Jan 27, 2024 via email

@karpolan
Copy link

karpolan commented Jan 27, 2024

The issue disappears if change baseDirectory from "out" back to default ".next"

P.S. I also changed the building image to "Amazon Linux:2023"

image

@karpolan
Copy link

karpolan commented Jan 27, 2024

LOL, but after a successful build and deployment, the website is not working...

I love Apmlify (c)

@NickRumenov
Copy link

NickRumenov commented Jan 29, 2024

Any updates on this? Still facing the problem

@dancj
Copy link

dancj commented Apr 5, 2024

I'm facing this issue as well with next 14.1.4 app with SSG pages hosted on amplify.

The next docs are explicit about using output: "export" in my next.config.js and that it will output to out folder:
https://nextjs.org/docs/app/building-your-application/deploying/static-exports

It builds locally but with my build settings like this, getting the Can't find required-server-files.json error on amplify.

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - npm ci
    build:
      commands:
        - npm run build
  artifacts:
    baseDirectory: out
    files:
      - '**/*'
  cache:
    paths:
      - .next/cache/**/*
      - node_modules/**/*

@isoppp
Copy link

isoppp commented Jun 12, 2024

I faced a similar problem when trying to host static Storybook files which is in Next.js dir. My issue was resolved by switching the platform from WEB_COMPUTE to WEB using the CLI.

aws amplify update-app --app-id your-amplify-app-id --platform WEB --region your-region

Reference: https://docs.aws.amazon.com/amplify/latest/userguide/redeploy-ssg-to-ssr.html#update-platform

Hopefully it could be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

8 participants