Dan Van Brunt
09/14/2021, 9:00 PMyarn create serverless-stack my-sst-app --language typescript
I then created a folder in the root called /frontend
then I copied all my react-app src into there
then I used the example StaticSite
code…
new StaticSite(this, 'GatsbySite', {
path: 'frontend',
errorPage: '404.html',
buildOutput: 'public',
buildCommand: 'yarn build',
})
then I ran yarn sst deploy
then it ran in a loop over and over, endlessly.
Answer:
Took a sec but I realized that the above example code to yarn build
but the root sst package.json is already set to _"build"_: "sst build",
hence the loop.
What IS the buildCommand supposed to be set to by example?
buildCommand: 'yarn build:frontend',
or
buildCommand: './frontend/yarn build',
thdxr
09/14/2021, 9:15 PMthdxr
09/14/2021, 9:15 PMpath
folderDan Van Brunt
09/14/2021, 9:19 PMbuildCommand: 'yarn build:frontend',
and then just changed that script to ls
(my public folder is already built / just to test)
I’m now getting what I think is that shatty frontend code Custom Resource deployment timeout we talked about months ago @Frank?Dan Van Brunt
09/14/2021, 9:20 PMGatsbySiteCustomResourceUploader
Dan Van Brunt
09/14/2021, 9:30 PMFrank
GatsbySiteCustomResourceUploader
, can you see the invocation timed out?Frank
GatsbySiteCustomResourceUploader
and GatsbySiteCustomResourceHandler
(for the failed request), I can dig into it.Frank
Dan Van Brunt
09/14/2021, 11:47 PMFrank
Dan Van Brunt
09/15/2021, 12:41 AM[ERROR] 2021-09-14T23:57:35.688Z 573a2346-cae0-4ca1-9912-d33a76fdef9f Read timeout on endpoint URL: "<https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/dev-idx-my-stack-GatsbySiteCustomResourceUploader5-EWe6RumZcM2I/invocations>"
Dan Van Brunt
09/15/2021, 12:56 AM| 1631663732384 | Completed 199.7 MiB/~199.7 MiB (3.6 MiB/s) with ~0 file(s) remaining (calculating...)
| 1631663732838 | END RequestId: b887e0c8-5337-4cfa-b611-e040ac4cfd84
Frank
Frank
StaticSite
packages the site in multiples of 200MB zip files. And the CustomResourceHandler
invokes 1 CustomResourceUploader
per zip file. And the Uploader will unzip and s3 sync
the files to the website bucket. Capping the zip file size to 200MB allows us to around the Lambda function’s 500MB disk space limit, and also to speed up the deployment by syncing files in parallel.Frank
CustomResourceHandler
log you shared, there are 2 zip files:
...
'Sources': [{
'BucketName': 'cdktoolkit-stagingbucket-19ujzje04kto1',
'ObjectKey': 'assets/b74912c6736afc62353b1982d3c0d5011fa280497f728c76ef92245dfed6ff92.zip'
}, {
'BucketName': 'cdktoolkit-stagingbucket-19ujzje04kto1',
'ObjectKey': 'assets/5aac677073201a39e0b456b3813b3d849a1ab14e5558197a98cea26f95145bde.zip'
}],
...
And 2 uploaders were invoked, 1 succeeded and 1 had the read timeout:
...
s3_deploy <-- one uploader invoked s3_deploy <-- another uploader invoked {'Status': True} <-- one uploader succeeded
...
Frank
CustomResourceUploader
log you shared, it seems to be of the uploader that succeeded. Can you check if there are logs from the other uploader? (it should be logged to another log stream in the same log group around the same time)Dan Van Brunt
09/15/2021, 12:05 PMDan Van Brunt
09/15/2021, 12:08 PM…71
I already send and here is …4b
Dan Van Brunt
09/15/2021, 1:24 PMrollback_complete
state. But even though the functions are deleted, their logs are still there.Dan Van Brunt
09/15/2021, 1:36 PMDan Van Brunt
09/16/2021, 1:30 AMFrank
Frank
Frank
Completed 199.7 MiB/~199.7 MiB ...
It makes me believe the Uploader function was never invoked to sync the 32MB file.Frank