sladg / nextjs-lambda

Lambda deployments for Nextjs12 & Nextjs13 (standalone). Easy CLI commands to get your standalone Next output to run in AWS Lambda (not @Edge)! Uses CDK in behind and produces code zips importable to Terraform, Serverless, Azure, etc.
MIT License
173 stars 19 forks source link

Error: Public folder assets must be nested in public/assets folder #49

Closed tim-trifecta closed 1 year ago

tim-trifecta commented 1 year ago

Hello! I was using the npx --package @sladg/nextjs-lambda next-utils pack command and I keep getting the error: Process failed with error: Error: Public folder assets must be nested in public/assets folder.

My next config looks like this:

const nextConfig = {
    reactStrictMode: true,
    swcMinify: true,
    output: "standalone",
    compress: false,
};

I am using the command in the root directory and have my public folder structured like this: public/assets/files.svg, etc.

is there something im not setting up correctly?

Much appreciated!

sladg commented 1 year ago

Hey! Can you try running ls -la ./public?

There might be some hidden files generated by system (happens especially on MacOS) that might be causing structure to not be correct.

tim-trifecta commented 1 year ago

That was it, there was the autogenerated .DS_Store folder in the directory. After removing the directory it packed up properly! Thanks again!

akshitkrnagpal commented 1 year ago

Hey @tim-trifecta

I am also seeing the same error. After some investigation, I figured out it's happening because I have .well-known folder in public directory.

Could you help me understand what I am doing wrong here? I would really appreciate it. 😄

sladg commented 1 year ago

Run ls -la1 ./public it should give you list of all files/folders, even hidden ones. Script expects just a single folder, aka. assets to exist, if anything else exists in public folder, it will return error as your structure is not compatible.