Posts

Showing posts from 2020

Web Deploy detected insufficient space on disk in Azure

Error:  Web Deploy detected insufficient space on disk. Explanation: In Azure Portal, When you run release pipeline using Web Deploy method and you have subscription that is free or provide less storage then you can face this error. Solution: To overcome this issue either you need to reduce the size of your project if you want to use free subscription or update your plan either to shared or some other plan that has required configuration. Thanks!

Azure - Failed to deploy web package to App Service. Internal Server Error (CODE: 500)- Fixed

Image
Error:  Failed to deploy web package to App Service. Internal Server Error (CODE: 500) Explanation: I was getting this error when trying to deploy azure functions with release pipeline. I got this and there was no additional information logs with this. I wasted my one day on this issue. Find Error: You can see the actual error by changing  deploy method for  web deploy   by editing your pipeline. My Root Cause:  "Web Deploy detected insufficient space on disk." So this was the issue for me, it may be because of my subscription.  For different persons root cause might be vary but you can see actual error using this deploy method and can apply your fixes accordingly. Thanks!!!

Swagger for Azure functions: Undocumented TypeError: Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body. Fixed.

Error -  Undocumented TypeError: Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body.  Root Cause: I have my Azure functions Project for which I am configuring swagger documentation using Nuget Package " AzureExtensions.Swashbuckle ". When I am opening swagger url in browser and I try one get method then I face this error because 'Get' method has body that should not. My function code is:  public async Task<IActionResult> Test(             [HttpTrigger(AuthorizationLevel.Anonymous, Http.Methods.Get, Route = Version + "/test")] HttpRequest request,             ExecutionContext context, IBinder binder)         { } Solution: To remove the body from 'Get' method, I need to specify some ignore attribute to function parameters as below.  public async Task<IActionResult> GetTest(             [HttpTrigger(AuthorizationLevel.Anonymous, Http.Methods.Get, Route = Version + "/test")] HttpRequ

npm ERR! Unable to authenticate, need: Bearer authorization_uri=https://login.windows.net/*********, Basic realm="https://pkgsprodcus1.pkgs.visualstudio.com/", TFS-Federated Fixed

Error -  npm ERR ! Unable to authenticate , need : Bearer authorization_uri = https : //login.windows.net/*********, Basic realm="https://pkgsprodcus1.pkgs.visualstudio.com/", TFS-Federated Root Cause - When you have configured your package registry in .npmrc file as below. registry =https://<your-organization-cloud>.pkgs.visualstudio.com/_packaging/bdcNpmFeed/npm/registry/ And your credentials are not updated or has expired then you can face the authentication issue. Solution - run below command in visual studio code to get authenticated. vsts - npm - auth - config . npmrc Thanks

Unexpected token T in JSON at position 0 in Angular CLI 6 - Fixed

Error -  Unexpected token T in JSON at position 0  Root Cause - When upgrading to Angular CLI 6 and then you run build or install command then you can face this error. Solution - Make sure correct version of Angular CLI is installed. For me Angular CLI 6 did not work so finally I upgraded directly to Angular 7 instead of Angular 6 first as per angular upgrade guide . Thanks

The serve command requires to be run in an Angular project, but a project definition could not be found - Fixed

Error -  The serve command requires to be run in an Angular project, but a project definition could not be found Root Cause - When there is no project definition file in your project then you will see this error when you will run ng-serve or ng-build commands. Project definition file - In Angular project definition file is generated when you create new application or upgrade existing application. In Angular versions lesser than 6 this file name is .angulat-cli.json  and in Angular version 6 and above it's name is angular.json . Solution -   So while running the angular build or run commands make sure you have correct project definition file. If you are upgrading your application from Angular 5 or lesser versions to Angular 6 and greater versions then you need to run below command to generate new project definition and other related files. ng update @angular/cli   // run it twice, If it's not generating then again try to run below commands in same sequence. npm install -g @angu

Your global Angular CLI version (8.3.3) is greater than your local version (1.6.5). The local Angular CLI version is used.

Warning -  Your global Angular CLI version (8.3.3) is greater than your local version (1.6.5). The local Angular CLI version is used. Explanation - When you run an angular application and you have different versions of Angular CLI installed globally and in local project then you can see this warning or error. Solution - There are 3 things here. Either you can continue with this warning You can install matching version of angular CLI to global in local project by using below command.           npm install @angular/cli@version         3. Install Latest version of Angular CLI globally and in project as well.          To install latest angular CLI globally use below command.           npm install -g @angular/cli          To install latest angular CLI in project use below command.           npm install @angular/cli Thanks

Cannot find module 'rxjs-compat' in Angular 9

Error -  Cannot find module 'rxjs-compat'. Complete error look like this. ERROR in node_modules/rxjs/Rx.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat' Root Cause - When you update your angular application from Angular 2/4/5 to Greater versions of Angular then some times you face this error. Angular CLI does not add 'rxjs-compat' package automatically or some issue in the package. Solution - To get rid of this error install this package in the application. npm install rxjs-compat Thanks

Property 'map' does not exist on type 'Observable' while upgrade to Angular 6/7/8/9 from Angular 5/4/2

Error -  Property 'map' does not exist on type 'Observable<Response>' Root Cause - When you upgrade your application from Angular 2/4/5 to Angular 6/7/8/9  then there are some functions that can not support in major versions.  Solution - To get rid of this error change your import statements as below. import  { Observable }  from   'rxjs' ; import  { catchError, map }  from   'rxjs/operators' ; And change your implementation for map function as below using ' Pipe ' function. delete(url: string, options?: any): Observable<any> {          return   this ._http.delete( ` ${ this ._baseUrl }${ url } ` , options)             .pipe(                 map(result  =>  {                      return  result;                 }),                 catchError((e: any)  =>  Observable.throw( this .errorHandler(e)))             );     } Thanks!!!

Property 'catch' does not exist on type 'Observable' in angular 6/7/8/9 Fixed

Error - Property 'catch' does not exist on type 'Observable<any>' in Angular. Root Cause - When you upgrade your angular application from Angular 2 or Angular 4 to Angular 6 or greater versions then you can face this error.  As From Angular 5 onwards there were many changes in rxjs. I Solution - To fix this error change your import syntax as below. change 'catch' to 'catchError'. import  { Observable }  from   'rxjs' ; import  { catchError, map }  from   'rxjs/operators' ; Thanks

Fixed: The required column was not present in the results of a 'FromSql' operation in asp.net core EF core

In EF core you will face this error many times. Error:  The required column was not present in the results of a 'FromSql' operation. To fix this error either remove the column from mapped model or add UnMapped attribute.     public class Customer     {         /// <summary>         /// Gets or sets the ID for the customer         /// </summary>         [UnMapped]         public int CustomerName { get; set; }     } Some Essential Interview Questions

Fixed: Unable to get MSI token from local Visual Studio

There are many scenarios where you need to use Managed Identity Services for authentication. You setup all the things correctly but in local setup you may encounter this below error. Error - "Unable to get MSI token from local Visual Studio" Solution - To fix this use below steps. Go to Visual Studio Tools Go to Options Go to Azure Service Authentication. Now Make sure, your account is there or not. if its there try to add same account again so it will override your credentials if these has expired or changed. It will solve your error. Thanks

Solved: RangeError: Maximum call stack size exceeded when using valueChanges.subscribe

RangeError: Maximum call stack size exceeded when using valueChanges.subscribe public  tokenAcquired: BehaviorSubject<any> =  new  BehaviorSubject<any>( '' ); //from where you want to trigger the subscription this .appService.tokenAcquired.next(tokenStored.accessToken); //where you are subscribing this .appService.tokenAcquired.pipe(     distinctUntilChanged())  // it will emit if value is different then last     .subscribe((token)  =>  {        if  ( this .debugMode) {         console.log( "token acquired and calling getApps." );       }        this .getApps();     })

Azure - website publish fail due to path long

Add below code to PropertiesGroup in .csproj file. <IntermediateOutputPath> ..\Temp </IntermediateOutputPath>

Solved: MSAL with Angular2 : Refused to display in a frame because it set 'X-Frame-Options' to 'deny'

MSAL with Angular2 : Refused to display in a frame because it set 'X-Frame-Options' to 'deny' we get this error when you are not setting redirectUri in your loginRedirect or acquireTokenRedirect methods in your angular or js code. Solution : Add redirectUri in (loginRedirect or acquireTokenRedirect) methods or at msal configuration level. editProfile() { var  authority =  `https:// ${ Domain } /tfp/ ${ tenant } / ${ profileEditPolicy } ` ;      /* just calling acquiretokenRedirect with different policy and authority            to edit profile,           no need to pass redirectUri as authority will decide */      this .authService.acquireTokenRedirect({       scopes: [Scopes], // https://yourApp.b2clogin.com/yourApp.onmicrosoft.com/profile_edit_policy       authority: authority , redirectUri: "your App url",     }); } Thanks

Solved: redirect_uri_mismatch Azure AD B2C with angular using MSAL || MSAL Profile Edit

Profile Edit in MSAL if you are using msal in Angular Application and trying to edit profile then follow below steps. 1. Set the Profile edit policy and  prepare authority. 2. Set redirectUri at the configuration level or here in below code. if you do not set the redirectUri you will get this error : "MSAL with Angular2 : Refused to display in a frame because it set 'X-Frame-Options' to 'deny'" 2. Call acquireTokenRedirect as below.  editProfile() { var  authority =  `https:// ${ Domain } /tfp/ ${ tenant } / ${ profileEditPolicy } ` ;      /* just calling acquiretokenRedirect with different policy and authority       to edit profile,      no need to pass redirectUri as authority will decide */      this .authService.acquireTokenRedirect({       scopes: [Scopes], // https://yourApp.b2clogin.com/yourApp.onmicrosoft.com/profile_edit_policy       authority: authority     }); }

cannot read property 'subscribe' of undefined in Angular

cannot read property 'subscribe' of undefined in Angular You will get this error when you initialize the subject as below. public  tokenAcquired: Subject<any>; and calling subscribe method over it as below. this .appService.tokenAcquired.subscribe((token)  =>  {        this .getApps();     }) Solution - To fix this error declare and initialize the subject as below. public  tokenAcquired: Subject<any> =  new  Subject<any>(); Thanks QFLES