https://pulumi.com logo
#general
Title
# general
a

acceptable-oil-81004

12/03/2021, 7:50 PM
Hey guys, does anyone have an sample using function/sourcecodehash? MY lambdas source are not being updated after uploading new binaries to S3
1
the doc mentions
filebase64sha256
which I cannot find anywhere
after some googling I made it work with this hashing method. The outcome is then set to the lambda sourceCodeHash property. Updates worked as expected
Copy code
public static string GetSHA265Base64Checksum(string filename)
		{
			using (var hasher = System.Security.Cryptography.HashAlgorithm.Create("SHA256"))
			{
				using (var stream = System.IO.File.OpenRead(filename))
				{
					var hash = hasher.ComputeHash(stream);
					return Convert.ToBase64String(hash);
				}
			}
		}