I'm using SST to create a StaticSite using Next.js...
# help
b
I'm using SST to create a StaticSite using Next.js. It worked the first couple of times I deployed. However, now I'm getting the following error:
Copy code
demo-scripts-now-client-StaticSite | CREATE_FAILED | Custom::SSTBucketDeployment | NextSiteCustomResourceAFBA8221 Received response status [FAILED] from custom resource. Message returned: [Errno 28] No space left on device (RequestId: 20d36fd2-65f7-4ecd-a4df-bcbde7a23bbd)
Any ideas why this would be happening?
f
Hey Brett, how big is your
buildOutput
folder?
ie. the folder you are setting as
buildOutput
in the StaticSite
b
Hmm … little bigger than I would have expected. About 550MB.
f
hmm does it keep growing?
Currently there’s a 500MB limit for the build output b/c syncing files to S3 is done through a custom resource using a Lambda function.
And Lambda function has a disk space limit of 500MB, and you probably hit that limit.
b
Ah right. Ok. Will see what I can do. The static build of Next.js is adding redux store data on every page. And there are 800-odd pages.
Will have to see if there's another option.
f
I see. Let me know what you find.
There is a way to get around the 500MB limit by using multiple Lambda functions to do the upload concurrently. Not only it will get around the 500MB limit, but also makes the upload faster.
But before we go down that route, I’m just curious if there’s any quick optimization you can do on Next.js side.
b
Sounds good! How do I do that?
f
It’s something we need to implement on the SST side.
Do you have a sample repo with SST + Next.js; or a tutorial u followed to setup Next.js on lambda?
So I can playaround with it and put something in.
b
I’m statically generating the Next.js site. So I just adapted your examples from the SST Static Site docs. Similar to that for Gatsby, etc.
I will post a demo later. AFK atm.
f
That’d be awesome! Keep me posted. In the meanwhile, I will try to get a beta version of the parallel upload working.
b
That’d be awesome too! Thanks 🙏
f
Hey @Brett Gullan, just released v0.34.0 to get around the 500MB limit for
StaticSite
Give it a try and let me know if it works for you!