Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in CheckGeneratorFunction.cs file #12

Closed
Pip1987 opened this issue Feb 20, 2024 · 1 comment
Closed

Errors in CheckGeneratorFunction.cs file #12

Pip1987 opened this issue Feb 20, 2024 · 1 comment

Comments

@Pip1987
Copy link

Pip1987 commented Feb 20, 2024

When i copied the CheckGeneratorFunctions from the book I noticed I had missing using references

using SixLabors.ImageSharp; // To use Image Class.
using SixLabors.ImageSharp.PixelFormats; // To use Rgba32 type.
using SixLabors.ImageSharp.Processing; // To use mutate.

I needed to change
public byte[] Run( [QueueTrigger("checksQueue")] string message)
to
public byte[] Run([QueueTrigger("checksQueue")] Azure.Storage.Queues.Models.QueueMessage message)
and the following mislabeled variables.
log.LogInformation($"Blobs folder: {folder}");
to
_logger.LogInformation($"Blobs folder: {folder}");

log.LogError(ex.Message);
to
_logger.LogError(ex.Message);

@markjprice
Copy link
Owner

Hi Phil, thanks for these issues. I have created an errata item for them here:
https://github.com/markjprice/apps-services-net8/blob/main/docs/errata/errata.md#page-462---implementing-a-function-that-works-with-queues-and-blobs

  1. The first issue was due to a breaking change in ImageSharp.
  2. The second issue with the logger was my mistake not updating all the variable references in the book after changing them in code.
  3. The issue you had with the message parameter I think might have been caused by something else: I had not created a .http test file to trigger the check generation. I think you might have run the other test file that calls the NumbersToWords function. I think that because that's exactly what I did too! And that doesn't trigger the queue. So I thought it was broken too initially. But then I noticed the missing test file and tried again and it worked correctly. I also updated the Azure packages to their current latest and they still work with the message parameter as a string as in the book. If you change the parameter to a QueueMessage then that'd work too but only if you also make more changes throughout the code to convert the message.Body into a string value for printing.

Keep up the great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants