Author: Alex
-
Mocking FunctionContext GetLogger using Durable Functions Isolated Worker
Although you can inject your ILogger<T> into the constructor of your function, sometimes you may want to use the FunctionContext from your trigger method. Mocking this for testing can be a bit tricky. Consider the following function: We want to write tests for our class. For this to be testable, we’ll need to somehow mock…
-
Using nginx to send webhooks to multiple upstreams
Forwarding webhook requests from a single endpoint, to multiple ‘upstream’ endpoints could be useful in many scenarios. A lot of applications that dispatch webhooks only allow one url, however, which can be a bit of a limitation. This pattern also simplifies maintenance. For instance, you can whitelist the relay IP while keeping your upstream endpoints…
-
Is user-agent a privacy concern?
Recently, I had a discussion with an e-commerce client about the implications of logging user-agents for their customers. Are there any privacy concerns involved? Can this data be used for anything other than identifying the browsers customers use to visit the site? And what about customers browsing in incognito mode – does the user-agent reveal…
-
This PC can’t run Windows 11
I downloaded the PC Health Check application to make sure my new machine could run Windows 11. My confidence was high, as the specs of my machine were pretty good: Motherboard: ASUS ROG STRIX B550-F GAMING (WI-FI) CPU: AMD Ryzen 9 3900X RAM: 64GB However, when I ran the tool, to my surprise, I got…
-
Beware of Facebook Phishing scam based on ‘Local’ news
This particular phishing scam is currently in circulation on Facebook. An account will post a clickbait news story, relevant to your local area, designed to cause panic – a child abducted, for example. (I’ve obfuscated the name / photo of this, as it’s likely the account was a compromised account – probably from a similar…
-
Cosmos DB Change Feed Processed by Azure Functions – Application Insights Telemetry
While working with a Cosmos DB Change Feed processor running as an Azure Function, I noticed that ‘requests’ are logged as Application Insights telemetry, but show up with no URL, and a response Code of 0. I was able to reproduce this using a lean example, generated from the func new generators. (Code available here:…
-
Satay Chicken Recipe
Ingredients Aprox 400g chicken thigh fillets 2tbsp peanut butter (proper stuff – 100% peanuts) 1tbsp dark soy sauce 1tsp honey Splash of boiling water (to help melt the peanut butter / make a ‘creamy’ sauce) 2 spring onions 2 cloves garlic Handful of spinach (or pak choi) To make the marinade Mix the peanut butter,…
-
How To Make Dalgona Coffee
Dalgona coffee is made by whipping equal proportions of instant coffee powder, sugar, and hot water until it becomes frothy and then adding it to cold or hot milk. It’s surprisingly easy to make. Serves 2 2tbsp instant coffee (I used Nescafe Azera Americano) 2tbsp Sugar (I used golden caster sugar) 2tbsp very hot water…
-
‘No resources found’ error when publishing to Azure App Service using Visual Studio 2019
Yesterday, I tried to publish an app to Azure App Service from Visual Studio 2019 (right-click -> publish) (I know, I know… but I just wanted to try this feature out!) I had already set up my Linux App Service Plan (size B1) On clicking publish, and selecting “use existing” I was seeing a rather…
-
Amazon is blocking my VPN (which is hosted on AWS!)
I run a very simple OpenVPN server in an Amazon Lightsail VM. This is to provide me with a ’static’ IP address, I can whitelist for access to some services. However, recently, I’ve noticed Amazon (.co.uk) has been blocking me from using the shopping site when connected to my VPN. I will get the following…
-
NSwag build error – Project file does not exist / Unable to retrieve project metadata
While working on a project that used NSwag, when the solution was built, Visual Studio (and dotnet build from the command line) reported the following error: View the code on Gist. Pretty frustrating, as it wasn’t clear what the error meant. This project used NSwag.MSBuild to generate the client on build. As per their documentation,…
-
GSuite Legacy Free Edition no longer supports email to Groups from outside domain
One of my clients is still using the legacy free version of GSuite legacy free edition Prior to December 6, 2012, Google offered a free edition of G Suite—also known as the legacy free edition—that had a reduced set of business features. As of December 6, 2012, Google stopped offering the free edition to new customers. I followed the…
-
Tide Bank Doesn’t Send Funds From Your Account
Until recently, Cohoda LTD held a Tide Banking account. Tide is a ‘challenger’ bank, attempting to disrupt the business banking market. There’s a major problem with this bank, however. They don’t transfer funds from your Tide account, they use a holding / intermediary account. Without telling you. We uncovered this problem when we transferred a…
-
Opening first few lines of a huge file with VS Code
I’m currently doing some work looking at the GeoNames dataset. `allCountries.txt` is around 1.5gb, which is pretty large, and certainly too large to open up in vscode for a quick look. However, I found I could use `head` command, which reads the first n lines of a file, and pipe the output to `code -`…
-
Medium Wont Add Canonical Links Despite Broken Import Tool
Medium has to be one of the most disjointed platforms I’ve ever used. Their import tool recently stopped working, inexplicably, simply throwing this error, with no further explanation: Without the import tool, it’s impossible to set a canonical link back to the original source of the content (which should definitely be your own blog) –…
-
Using Google Sheets and Azure Functions as a headless CMS
One of my clients came to me with a relatively simple requirement; they needed to take online payments for their fitness event photography business. The model is quite simple: There are several different competition dates per year. Competitors can purchase professional photos of themselves at a competition. Each competitor will have a ‘badge number’ to…
-
Using Mediatr with Azure Functions
I’ve used Mediatr for some time, to reduce controller action bloat, and have spoken about it a few times, on how I use it to avoid the classic ‘xService’ pattern: Controller Action -> ‘Service’ -> Repo Lately, I’ve been doing a lot of work with Azure Functions, and would like to be able to use…
-
Registration Form Used To Send Spam Via Welcome Email
While reviewing a client site, I recently noticed a small number of accounts had registered with spurious firstName and lastName values such as: firstName:You have 5 new messages from Patty: lastName: http://www.nsbe.org/impakredirect.aspx?url=http://project1200995.tilda.ws After some digging, it appeared these customers had legitimate email addresses, however had placed no orders, nor had they interacted with our site.…
-
Reliably Processing Azure Service Bus Topics with Azure Functions
At ASOS, we’re currently migrating some of our message and event processing applications from Worker Roles (within classic Azure Cloud Services) to Azure Functions. A significant benefit of using Azure Functions to process our messages is the billing model. As an example, with our current approach, we use a Worker Role to listen to subscriptions…
-
Disable gzip responses in Azure Functions
By default, responses from Http Triggered Azure Functions are gzipped: Not all clients are able to handle this (although they should be) Turning it off isn’t particularly trivial. A change needs to be made to applicationhost.config – which is located in LocalSiteRoot/Config However, this file is readonly, so the change needs to be made via…
-
A Seller On Amazon Offered Me An Incentive To Leave A 5* Review
I buy a lot on Amazon. Probably too much. I enjoy the convenience, pricing (mostly) and reviews. Reviews, however, have to be looked at carefully. Some sellers, particularly new sellers (or selling new products) offer incentives for 5* reviews. I knew this practice happened, but I’d never experienced it first hand. I recently bought a…
-
Some products on Amazon cost MORE on Amazon Prime, Even For Prime Members!
Earlier today I was looking to purchase an item on Amazon. (2x VonHaus Vertical Wall Mount Bike Cycle Storage Hooks to be specific) I found them for £7.99 – available next day, on Prime. However, I noticed it was available £1 less in the “other sellers” bit. Curious, I took a look: Both same product…
-
Better assertions when verifying Moq’d methods have been called
Moq, according to its GitHub page, is “The most popular and friendly mocking framework for .NET”. Mocking frameworks allow you to create a ‘fake’ version of a dependency (typically an interface, or abstract class). With this fake, you can then instruct the methods return values, or invoke behaviour. Alternatively you can assert the methods were called,…
-
Reversing hashes of PwnedPasswords api using number of breaches
I was recently working on a requirement to log the number of breached sites a password appeared on when customers were registering (if that password had been breached at all) Importantly, we are not logging the breached password itself (nor the hash of the password) – just the number of breaches that particular password appeared in…
-
Hide Sensitive Data with Application Insights JavaScript SDK using a Telemetry Initializer
Application Insights is incredibly powerful, especially when using the JavaScript Client SDK. The problem is, sometimes we can be logging a little too much. We can use a Telemetry Initalizer to hide sensitive data in dependencies / requests logged with Application Insights.