This is a migrated thread and some comments may be shown as answers.

ERROR Error: Uncaught (in promise): Invalid clientID

9 Answers 1986 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Godfrey
Top achievements
Rank 1
Godfrey asked on 14 Jul 2020, 02:07 PM

Hi folks 

I'm having problem with Telerik Reporting using Angular 8. it throwing this error ERROR Error: Uncaught (in promise): Invalid clientID. 

the below is how i setup viewer.

<tr-viewer #viewer1
    [containerStyle]="viewerContainerStyle"
    [serviceUrl]= "'http://example/api/reports'"
    [templateUrl]="'/assets/template.html'"
    [reportSource]="{
        report: 'BillingDetails.trdx',
        parameters: {}
    }"
    [viewMode]="'INTERACTIVE'"
    [scaleMode]="'SPECIFIC'"
    [scale]="1.0">
</tr-viewer>

 

WEB API 

 [EnableCors(origins: "http://localhost:4200", headers: "*", methods: "*")]
 [RoutePrefix("api/reports")]

        protected override Telerik.Reporting.Cache.Interfaces.ICache CreateCache()
        {
            return CacheFactory.CreateFileCache();
        }

        protected override Telerik.Reporting.Services.Engine.IReportResolver CreateReportResolver()
        {
            string reportsPath = HttpContext.Current.Server.MapPath("~/ReportFiles");

            var r = new ReportFileResolver(reportsPath).AddFallbackResolver(new ReportTypeResolver());

            return r;
        }
    

Client side is separated from webAPI, i'm making Http calls to request resources from web API. JQuery and/or Angular 8 solutions will be appreciated. 

Thanks

 

9 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 17 Jul 2020, 11:41 AM

Hello Godfrey,

I tested with the Angular example application which comes with the installation of Telerik Reporting (usually in C:\Program Files (x86)\Progress\Telerik Reporting R2 2020\Examples\Angular\CLI). Just changed the serviceUrl to point to the Html5Demo application located in the same examples folder and enabled CORS there. All worked correctly. Can you test the same approach on your end?

If the issue persists, please provide a Fiddler/Network log and/or a sample application exhibiting the issue.

Regards,
Nasko
Progress Telerik

0
Godfrey
Top achievements
Rank 1
answered on 16 Sep 2020, 04:44 PM

Hi Nasko 

First of all, the api/reports/formats is working, it returns array of objects. which mean the api is working as expected.

Secondly, angular  application is not working, it can load the template but within it  it showing this error message "Unable to get report Paramerer".  see the attached files to view the network logs and console logs. i have enabled the cors. see the below and the attached 

    using System.Web.Http.Cors;
    [EnableCors(origins: "http://localhost:4400", headers: "*", methods: "*")]

 

Please advise. this it shouldn't be difficult.  

 

 

0
Todor
Telerik team
answered on 21 Sep 2020, 10:05 AM

Hi Godfrey,

The CORS of the REST Service is indeed enabled as the requests prior to Get Report Parameters pass successfully. The error when trying to get the parameters is 405 'Method Not Allowed', which is not expected. You may see possible reasons for the error, for example in the 405 Method Not Allowed: What It Is and How to Fix It post.

Did you replicate the problem with our Angular demo?

If you need further help you may send us a runnable application for investigation.

Regards,
Todor
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

0
Godfrey
Top achievements
Rank 1
answered on 23 Sep 2020, 08:31 AM

Hi Todor 

Yes, i'm using Angular demo with C# web API. I can't upload executable code using compressed (zipped) folder, the size of my files are as 73 013 KB and 12 513KB, please advise how to upload these files. 

 

 

 

Looking forward to hearing from you. 

Thanks.

 

0
Todor
Telerik team
answered on 28 Sep 2020, 07:20 AM

Hello Godfrey,

You may upload files up to 40MB in a Support Ticket. In the Forum tickets, you may attach only images.

You may delete the node_modules folder, pack the project and upload it in a Cloud Storage like Google Drive and send us the link.

Regards,
Todor
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

0
Godfrey
Top achievements
Rank 1
answered on 07 Oct 2020, 08:12 AM

Morning Todor 

Please navigate to this google drive link to view source codes https://drive.google.com/drive/folders/1zE8Rfwc4-SD51CBXIWQWCgXtjFIjznGU?usp=sharing 

Looking forward to hearing from you.

Thanks.

0
Todor
Telerik team
answered on 12 Oct 2020, 09:53 AM

Hi Godfrey,

Unfortunately, I have no access to the project - see the attached screenshot. I have requested access from my Google account. I guess you need to approve it.

Regards,
Todor
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Godfrey
Top achievements
Rank 1
answered on 12 Oct 2020, 10:00 AM

Hi Todor

Now you should have access to the source codes. Please check and advise.

Regards

Godfrey

0
Todor
Telerik team
answered on 15 Oct 2020, 08:17 AM

Hi Godfrey,

I confirm that I was able to download the projects and reproduce the CORS issue.

I added the following necessary line in the Global.asax file:

protected void Application_Start()
{
    GlobalConfiguration.Configuration.EnableCors();
    ...

I had to remove the following section from the web.config file as it added a second CORS header, which was not allowed:

<httpProtocol>
	<customHeaders>
		<add name="Access-Control-Allow-Origin" value="*" />
	</customHeaders>
</httpProtocol>

The last problem was that the EnableCors attribute in the ReportsController referenced "http://localhost:4400" and I changed the port to 4200

[EnableCors(origins: "http://localhost:4200", headers: "*", methods: "*")]

This was sufficient for the Angular project to access the service. I have linked this silent video for your reference.

Regards,
Todor
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Henrik
Top achievements
Rank 1
commented on 23 Nov 2022, 01:14 PM

In fiddler I can see the reponse

 

{"Message":"An error has occurred.","ExceptionMessage":"The type initializer for 'Telerik.Reporting.Cache.Lock' threw an exception.","ExceptionType":null,"StackTrace":null}

Dimitar
Telerik team
commented on 28 Nov 2022, 12:41 PM

Hi Henrik,

We are currently investigating the problem in a support ticket due to the complicated scenario but for other users experiencing this problem, it is likely that the issue will be resolved by following the ASP.NET Core Project Crashes as External Assemblies Cannot Be Found - Telerik Reporting KB article.

Tags
General Discussions
Asked by
Godfrey
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Godfrey
Top achievements
Rank 1
Todor
Telerik team
Share this question
or