Hello all, I'm playing around with the ts static w...
# aws
f
Hello all, I'm playing around with the ts static website sample and everything seems to work so far but the uploaded files are all empty and I don't really understand why. I'm on a Mac and the source files are of course correct. The rest seems to work when I upload all the file via aws s3 sync or manually but this is not the idea 😕
w
Huh - haven’t seen that before. Do the resources in the state show non-zero sizes and/or content? For example, visiting the stack link in the Pulumi console?
f
it shows all files have a length of 0 bytes in the AWS console, in the resource view of the stack (on the pulumi website) I can see all the files and each individual file seems to be alright but I can't find any length information there... when I issue an "aws s3 sync" from the command line it is uploaded without a problem. If I delete all files from the bucket, call "pulumi refresh" to force an update of the pulumi repository and then try an "pulumi up" it uploads again only zero length files. All files have a length of zero bytes but one, a ".DS_store" file - I can remove it manually from my file system but it doesn't change a thing.
It does not seem to have anything to do with the .DS_store file at all 😕 I just copied the sample from the github website ... maybe I have to delete all stack resources and start from scratch ... strange
Still no luck, deleted the whole stack and recreated it. This is the result:
I took the source from the Typescript Static Website sample - the crawlDirectory method should do the trick:
onst webContentsRootPath = path.join(process.cwd(), config.pathToWebsiteContents);
console.log("Syncing contents from local disk at", webContentsRootPath);
crawlDirectory(
webContentsRootPath,
(
filePath: string) => {
const relativeFilePath = filePath.replace(webContentsRootPath + "/", "");
const contentFile = new aws.s3.BucketObject(
relativeFilePath,
{
key: relativeFilePath,
acl: "public-read",
bucket: contentBucket,
contentType: mime.getType(filePath) || undefined,
source: new pulumi.asset.FileAsset(filePath),
}, {
parent: contentBucket,
}); });
o
Do you have logs enabled on AWS side? Did you check those? There should be something there.
f
in the pulumi diagnostic logs I see many weird entries like these:
Waiting for state to become: [success] Reading S3 Bucket Object meta: { AcceptRanges: "bytes", ContentLength: 0, ContentType: "application/xml", ETag: "\"d41d8cd98f00b204e9800998ecf8427e\"", LastModified: 2019-12-30 202141 +0000 UTC }
the ContentLength is always 0. I've tried completely different files now, different bucket name, tried to isolate the upload method - still it uploads only 0 bytes.
o
To me it sounds like some strange permissions issue where the key (file name) is created, but then the upload fails. Could be entirely wrong though. I’d check permissions and logs on AWS side. CloudTrail, CLoudWatch, bucket logs, that kind of thing.
f
it works flawless from windows though (same stack, same files, same bucket) - maybe the mac tools are broken?!