- Downgrade to, "Microsoft.Azure.WebJobs.Extensions.Storage" version: 5.0.1
- Clean the solution and run it
Technical…Practical…Theoretically Explored - A Software Engineer's Journey Through Code, Architecture, and Ideas
Saturday, 1 April 2023
Error while upgrading Azure function to .NET6
Thursday, 19 January 2023
InvalidOperationException: Can't use schemaId for type The same schemaId is already used for type
After adding new bean to project I got below error during startup
13:44:19:254 ---> System.InvalidOperationException: Can't use schemaId "$Employee" for type "$staff.Employee". The same schemaId is already used for type "$test.Employee"
13:44:19:254 at Swashbuckle.AspNetCore.SwaggerGen.SchemaRepository.RegisterType(Type type, String schemaId)
13:44:19:254 at Swashbuckle.AspNetCore.SwaggerGen.SchemaGenerator.GenerateReferencedSchema(DataContract dataContract, SchemaRepository schemaRepository, Func`1 definitionFactory)
13:44:19:254 at Swashbuckle.AspNetCore.SwaggerGen.SchemaGenerator.GenerateConcreteSchema(DataContract dataContract, SchemaRepository schemaRepository)
13:44:19:254 at Swashbuckle.AspNetCore.SwaggerGen.SchemaGenerator.GenerateSchemaForType(Type modelType, SchemaRepository schemaRepository)
13:44:19:254 at Swashbuckle.AspNetCore.SwaggerGen.SchemaGenerator.GenerateSchema(Type modelType, SchemaRepository schemaRepository, MemberInfo memberInfo, ParameterInfo parameterInfo)
13:44:19:254 at Swashbuckle.AspNetCore.SwaggerGen.SchemaGenerator.CreateArraySchema(DataContract dataContract, SchemaRepository schemaRepository)
13:44:19:254 at Swashbuckle.AspNetCore.SwaggerGen.SchemaGenerator.<>c__DisplayClass10_0.
Solution :
The only change needed is in your Startup.cs inside the method ConfigureServices.
You should add the following:
services.AddSwaggerGen(options =>
{
options.CustomSchemaIds(type => type.ToString());
});
Wednesday, 7 December 2022
How do I fix dependency conflicts in npm install?
Today I was working on a front end app. I faced below error while running npm install command.
npm ERR! Conflicting peer dependency: @angular/core@6.1.10
npm ERR! node_modules/@angular/core
npm ERR! peer @angular/core@"^6.0.3" from @angular-redux/router@9.0.0
npm ERR! node_modules/@angular-redux/router
npm ERR! @angular-redux/router@"^9.0.0" from the root project
Fix for Conflicting peer dependency in node.js
- Downgrade the npm version to the previous version.
- remove the node_modules folder.
- remove package-lock.json.
- please do npm install one more time to do a fresh installation of the dependency.
Saturday, 12 March 2022
Detecting a active transaction in spring application
You can call this method and print output in logs. It will be true for active transactions false otherwise.
For example :
Sunday, 19 December 2021
Microservices Best Practices for the Optimal Architecture Design
Microservices have fundamentally changed the way server side applications are architected. Rather than a single giant monolithic codebase hosting all the business logic of your application, microservices reflect the distributed systems model, where a group of application components work together to deliver the business needs.
1. The Single Responsibility Principle
2. Have a separate data store(s) for your microservice
3. Use asynchronous communication to achieve loose coupling
To avoid building a mesh of tightly coupled components, consider using asynchronous communication between microservices.
4. Fail fast by using a circuit breaker to achieve fault tolerance
5. Proxy your microservice requests through an API Gateway
6. Ensure your API changes are backwards compatible
You can safely introduce changes to your API and release them fast as long as they don’t break existing callers.
7. Version your microservices for breaking changes
It's not always possible to make backwards compatible changes. When you are making a breaking change, expose a new version of your endpoint while continuing to support older versions. Consumers can choose to use the new version at their convenience. However, having too many versions of your API can create a nightmare for those maintaining the code. Hence, have a disciplined approach to deprecate older versions by working with your clients or internally rerouting the traffic to the newer versions.
8. Have dedicated infrastructure hosting your microservice
You can have the best designed microservice meeting all the checks, but with a bad design of the hosting platform it would still behave poorly. Isolate your microservice infrastructure from other components to get fault isolation and best performance. It is also important to isolate the infrastructure of the components that your microservice depends on.
9. Create a separate release train
10. Create Organizational Efficiencies
While microservices give you the freedom to develop and release independently, certain standards need to be followed for cross cutting concerns so that every team doesn’t spend time creating unique solutions for these. This is very important in a distributed architecture such as microservices, where you need to be able to connect all the pieces of the puzzle to see a holistic picture. Hence, enterprise solutions are necessary for API security, log aggregation, monitoring, API documentation, secrets management, config management, distributed tracing, etc.
By following these microservices best practices, you should end up with a loosely coupled, distributed, and independent microservice system, wherein you can achieve the true benefits of a microservices architecture as listed at the beginning of this article.
Thursday, 20 May 2021
Remove a file from git pull request
Scenario : You have updated a file that already existed in main branch and want to remove it from the pull request.
Assume you're working on a branch (say featureBranch) off of development (means you created featureBranch from the development branch) , and your pull request includes a file named AccountController.java.
To remove this file from the pull request and revert its changes, simply do :
1. Checkout your branch (featureBranch).
2. Run below command.
git checkout development -- AccountController.java
3. Commit and push into your branch (featureBranch).
Tuesday, 23 February 2021
IntelliJ | SLF4J: Failed to load class org.slf4j.impl.StaticLoggerBinder
JAVA standalone program failed with below error on IntelliJ (Community Edition 2020.3).
SLF4J: Failed to load class "org.slf4j.impl.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.Process finished with exit code 0
