Month: April 2018
-
Warning: Can’t call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method. – ReactJs
Hi everyone, This is just a quick post, mostly for my future reference but hopefully it will help someone else out as well. I ran into the following error when invoking a callback in a child component: Warning: Can’t call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a…
-
Include UserId in Login Response (Token) – Web API 2
Hi everyone, A quick post on how to include the user’s id in your login response when using Web API 2. The default response to the /Token request is as follows: { “access_token”: “xxxxxxxxxxxxx_xxxx”, “token_type”: “bearer”, “expires_in”: 1209599, “userName”: “test@test.com”, “.issued”: “Mon, 23 Apr 2018 06:08:03 GMT”, “.expires”: “Mon, 07 May 2018 06:08:03 GMT” }…
-
Module build failed: Error: ENOENT: no such file or directory, open – Windows
Hi everyone, I’ve been mucking around with React over the last couple of days. I ran into the following error while trying to build: Module build failed: Error: ENOENT: no such file or directory, open ‘c:…Form.js’ at Error (native) It took a while to sort this one out but I eventually came across a solution…
-
Cannot attach the file ‘C:…database.mdf’ as database x – Entity Framework
Hi everyone, I ran into the following error when attempting to run ‘update-database’ on an initial migration: Cannot attach the file ‘C:Users…App_Dataaspnet-…115933.mdf’ as database ‘aspnet-…15933’ The solution to this one is pretty easy, remove the initial catalog property from your connection string. …33.mdf;Initial Catalog=aspnet… This is apparently caused by issues with EntityFramework and multiple projects…
-
Retrieving User Id in Web API 2 Controller – .NET
Hi everyone, Just a quick post on how to retrieve the current user’s id in a Web API 2 controller: var userId = RequestContext.Principal.Identity.GetUserId(); Note that you’ll need the following using statements: using Microsoft.AspNet.Identity; using System.Web.Http; Thanks to the following stackoverflow post for the info: https://stackoverflow.com/a/21618056/522859
-
Git Ignore Template for .NET
Hi everyone, A sample .gitignore file for if you’re working with .net: *.cache *.dll *.exe *.pdb /build/ *.suo *.user _ReSharper.*/ *.sdf *.opensdf *.tlog *.log TestResult.xml *.VisualState.xml Version.cs Version.h Version.cpp Also, if you happen to have added some files you didn’t mean to: git rm –cached file_you_dont_want.pdb git commit -m “Remove pdb file” Thanks to these…
-
Import an Existing Project to BitBucket
Hi everyone, Today I needed to import an existing project to Bitbucket. The documentation is really good, but just in case you have trouble finding it: Navigate to the root directory of your project. Run the following commands in terminal/command prompt: git init git add –all git commit -m “Initial Commit” Login to Bitbucket and…
-
Unsupported_Grant_Type – MVC Web Api (error)
Hi everyone, I ran into the following error while attempting to authenticate using .NET Web Api: POST http://localhost:63720/Token HTTP/1.1 Host: localhost:63720 Content-Type: application/json Content-Length: 0 HTTP/1.1 400 Bad Request Content-Type: application/json;charset=UTF-8 Date: Mon, 16 Apr 2018 14:18:06 GMT Content-Length: 34 {“error”:”unsupported_grant_type”} This one was pretty straight forward. Ensure that have the correct content-type: Content-Type: application/x-www-form-urlencoded…
-
An error occurred (UnrecognizedClientException) when calling the CreateFunction operation: The security token included in the request is invalid.
Hi everyone, I ran into the following error today while attempting to create a Lambda function using the CLI: An error occurred (UnrecognizedClientException) when calling the CreateFunction operation: The security token included in the request is invalid. The first thing to check is that your aws config is setup correctly. For me this is under…
-
FAILED. Reason: Requires capabilities : [CAPABILITY_IAM] – AWS SAM
Hi everyone, I ran into an error today while trying to deploy using AWS SAM: aws cloudformation deploy –template-file C:Usersxxxserverless-output.yaml –stack-name events-app Failed to create the changeset: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state Status: FAILED. Reason: Requires capabilities : [CAPABILITY_IAM] The solution is pretty straightforward. You need to explicitly add –capabilities CAPABILITY_IAM…