Author Archives: Chris Owens

Missing .tsconfig when converting existing ReactJS project

Hi everyone,

I’ve finally decided to start learning typescript while working on a side project. The plan was to convert the existing project over using the following command:

npm install --save typescript @types/node @types/react @types/react-dom @types/jest

After restarting the web server I had expected to see a tsconfig.json file that would allow me to setup my preferred configuration. Unfortunately, mine was missing.

A bit of Googling revealed that the tsconfig file isn’t actually generated until you add a .ts or .tsx file to the project. In my case, I simply renamed an existing component and the configuration file was generated during the next startup. Note that you will also have to remove your jsconfig.json file (if you haven’t already).

Thanks to this blog for the detailed info:

Cognito Hosted UI User Pool – Google not showing

Hi everyone,

I’m implementing Cognito User Pools for an app and currently adding social providers (Google, Facebook, etc).

The setup process seems pretty straight forward, however the social options did not appear on my hosted ui.

It turned out that I’d missed the last step in the documentation:
– Go to “App Client Settings” (left hand menu under App integration)
– Look for “Enabled Identity Providers” and check any that you want to show

I found this a little unintuitive as I’d expected it to show once it was enabled in the “Identity Providers” section. I probably just need to learn to read ALL of the docs!


The full documentation is available here:

And the bulk of the configuration is performed here:

Unable to create object of type ‘ApplicationDbContext’ – Updating to .NET Core 3.0

Hi everyone,

I’ve just updated to .net core 3.0 and have been hitting a few issues. I hit this one while trying to add a migration:

Unable to create an object of type ‘ApplicationDbContext’. For the different patterns supported at design time, see

Adding -verbose to this allowed me to narrow the cause down a little further:

PM> add-migration add-propertyid-to-entities-for-events -verbose
Using project ‘PropertyApi’.
Using startup project ‘PropertyApi’.
Build started…
Build succeeded.
C:\Program Files\dotnet\dotnet.exe exec –depsfile C:\Users\Celeste\Documents\repos\property-api\PropertyApi\bin\Debug\netcoreapp3.0\PropertyApi.deps.json –additionalprobingpath C:\Users\Celeste\.nuget\packages –additionalprobingpath “C:\Program Files\dotnet\sdk\NuGetFallbackFolder” –runtimeconfig C:\Users\Celeste\Documents\repos\property-api\PropertyApi\bin\Debug\netcoreapp3.0\PropertyApi.runtimeconfig.json C:\Users\Celeste\.nuget\packages\\3.0.0\tools\netcoreapp2.0\any\ef.dll migrations add add-propertyid-to-entities-for-events –json –verbose –no-color –prefix-output –assembly C:\Users\Celeste\Documents\repos\property-api\PropertyApi\bin\Debug\netcoreapp3.0\PropertyApi.dll –startup-assembly C:\Users\Celeste\Documents\repos\property-api\PropertyApi\bin\Debug\netcoreapp3.0\PropertyApi.dll –project-dir C:\Users\Celeste\Documents\repos\property-api\PropertyApi\ –language C# –working-dir C:\Users\Celeste\Documents\repos\property-api –root-namespace PropertyApi
Using assembly ‘PropertyApi’.
Using startup assembly ‘PropertyApi’.
Using application base ‘C:\Users\Celeste\Documents\repos\property-api\PropertyApi\bin\Debug\netcoreapp3.0’.
Using working directory ‘C:\Users\Celeste\Documents\repos\property-api\PropertyApi’.
Using root namespace ‘PropertyApi’.
Using project directory ‘C:\Users\Celeste\Documents\repos\property-api\PropertyApi\’.
Finding DbContext classes…
Finding IDesignTimeDbContextFactory implementations…
Finding application service provider…
Finding Microsoft.Extensions.Hosting service provider…
Using environment ‘Development’.
System.ArgumentNullException: Value cannot be null. (Parameter ‘implementationInstance’)

The key part here are the fact that it can’t find the config values and that it’s attempting to use the ‘Development’ env whereas it should be looking for ‘Local’.

It seems that during the upgrade all of my environment variables have been wiped. All that was required was to run the following (change local to match your environment):


Running the add-migration command should now user the local configuration. Thanks to the following link for the solution:

‘add-migration’ is not recognized as the name of a cmdlet – .net core 3.0

Hey everyone,

I recently upgraded my .net core 2.2 project to .net core 3.0. When trying to add a migration I hit the following error:

add-migration : The term ‘add-migration’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1
+ add-migration events
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (add-migration:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

It turns out that there have been a few changes to how this all works. You’ll need to go to package manager console and run the following:

1) Install-Package Microsoft.EntityFrameworkCore.Tools
2) Update-Package Microsoft.EntityFrameworkCore.Tools
3) Get-Help about_EntityFrameworkCore

After running step three you should get something that looks like the following:

PM> Get-Help about_EntityFrameworkCore

Covered in full here:

View Raw SQL in EF Core – Simple Option

Hi everyone,

I’ve been looking for a simple way of viewing the raw output of sql in my local environment without having to make code changes and came across the following config setup:

“Logging”: {
“LogLevel”: {
“Default”: “Debug”,
“System”: “Information”,
“Microsoft”: “Information”

This will show the sql statements in your output window without requiring any additional code:

Thanks to this stackoverflow post for the answer:

Geography: one of the identified items was in an invalid format – Entity Framework

Hey everyone,

I’m currently working on a prototype using .net core, sql server, ef and NetTopologySuite to handle locations. While trying to save a location I ran into the following error:

Geography: one of the identified items was in an invalid format

My code was as follows:

using GeoAPI.Geometries;
using NetTopologySuite;
using NetTopologySuite.Geometries;

var geometryFactory = NtsGeometryServices.Instance.CreateGeometryFactory(srid: 4326);
Location = geometryFactory.CreatePoint(new Coordinate(request.Lat, request.Lng))

The solution ended up being pretty straight-forward. Simply swap the latitude and longitude values when creating a coordinate:

Location = geometryFactory.CreatePoint(new Coordinate(request.Lat, request.Lng))

// Use this instead
Location = geometryFactory.CreatePoint(new Coordinate(request.Lng, request.Lat))

This is mentioned pretty clearly when reading the documents but I somehow skipped over it. Hopefully this will be able to help out anyone else who does the same thing!

Official docs:

Simple React-Leaflet Location Picker Setup

Hi everyone,

Just thought I’d share a very simple react-leaflet setup in case it’s able to help anyone.


Add the css and javascript for leaflet to public > index.html:">

Install react-leaflet via npm or yarn, also add the dependencies:

npm install react-leaflet # npm
npm install leaflet react react-dom # npm

yarn add react-leaflet # Yarn
yarn add leaflet react react-dom # Yarn

Create the map component:

import React, { useState } from 'react'
import { Map, TileLayer, Marker, Popup } from 'react-leaflet'

const MapSimple = () => {

    const [location, setLocation] = useState({
        lat: 51.505,
        lng: -0.09,
        zoom: 13,
    const position = [, location.lng];
    const setMarkerPosition = e => {
        setLocation({ ...e.latlng, zoom: 19 });
        console.log(`My location is: ${JSON.stringify(e.latlng, null, 3)}`)

    return (
                attribution='© OpenStreetMap contributors'
                   A sample popup.

export default MapSimple;

Request Denied – react-geocode

Hi everyone,

I’m currently testing react-geocode but hit a “request denied” error after providing my API key.

Error: Server returned status code REQUEST_DENIED

The solution was pretty simple thankfully – enable the Geocoding API for your project:

In my case I was re-using a Google maps key from another project where I’d enabled all of the map apis but not the GeoCoding one.

Module not found: Can’t resolve ‘leaflet’ in – react-leaflet error

Hey everyone,

I ran into the following error after installing react-leaflet and attempting to run an example:

Module not found: Can’t resolve ‘leaflet’ in ‘…\node_modules\react-leaflet\es’

It turned out I’d simply rushed things and skipped the second step in the documentation:

npm install leaflet react react-dom # npm
yarn add leaflet react react-dom # Yarn