web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Self hosted event manager issue (cors error)

(0) ShareShare
ReportReport
Posted on by 487

Hi,

We are trying to implement self hosted event manager. But after loading the angular website and configuring the environment file, we get a CORS error in the website, and the data does not load.

When looking online, i found this: https://docs.microsoft.com/en-us/dynamics365/marketing/developer/portal-hosted (cors section) but we do not use self hosted portals, so we cannot set this up.

Any ideas please on how to make the event manager work? We have our own portal using the CRM api allready, tnad that does work.

Regards

I have the same question (0)
  • cloflyMao Profile Picture
    25,210 on at

    Hi John,

    There is no concept called "self hosted portal". There are two ways to host a event website:

    1. Portal hosted: our event website with be hosted on PowerApps Portal, it could be regarded as hosting an event website on Microsoft official website.

    The URL will be: xxx.powerappsportal.com

    2. Self hosted: our event website will be hosted on our own server. 

    The URL will be: ourdomain.com

    Please confirm your event website type, if its self hosted and you would like to test it locally,

    please instead following guide below:

    https://docs.microsoft.com/en-us/dynamics365/marketing/developer/register-web-application-events-api

    (register a web application in Marketing settings to use Event API)

    https://docs.microsoft.com/en-us/dynamics365/marketing/developer/self-hosted#web-application-environment-configuration

    (local file configuration)

    From your issue, it seems that you might not register a web application, if you test sample file locally, please make sure "">http://localhost:4200" has been set to "Origin" field value to whitelist our local server to run Event application. (4200 is the default port to run Angular application)

    pastedimage1589462195793v1.png

    Regards,

    Clofly

  • Hedi Daneels Profile Picture
    487 on at

    Hi Clofly,

    Thanks a lot, I found my CORS issue. I was using https in my origin url, but my dev environment was using http.

    I do have a new error now sadly, : code 502

    {Message: "An error has occurred."}

    Did you encounter that issue allready?

    edit: there is something weird tough, when i go to apiendpoint/.../ i get a 404, seems i cannot reach the event endpoint.

    edit: when i try to reach https://{{host}}/EvtMgmt/api/v2.0/events/published?emApplicationtoken={token} i get 400 error, which shouldnt happen from what I understand from the doc

    Cheers

  • cloflyMao Profile Picture
    25,210 on at

    Hi John,

    Could you explain what the meaning of "I was using https in my origin url, but my dev environment was using http."?

    As per my understanding, do you mean that in your dev environment(would be a local machine), 

    the URL of event website is http://localhost:4200?

    Now you want to deploy the event website to your public server, and HTTPS is enabled in your server(Apache or Nginx) setting. 

    so your "origin URL" with https is something likes: https://xxx.com.

    If my guess would be right:

    due to previously you only registered a web application for dev environment,

    please create a new web application for your production event website/environment, replace Token and Endpoint token properties in environment.ts file with the new value.

    Regards,

    Clofly 

  • Hedi Daneels Profile Picture
    487 on at

    Hi Clofly,

    I had registered https://localhost:4200, that is why I had a cors issue. The url to register was http://localhost:4200 (without the S).

    This is resolved.

    Now, I have a 502 "an error occured" error when i launch the event website locally. I get to see the interface, search box, change language, etc. But instead of seeing the data, i have that 502 error.

    So, I tried to use POSTMAN to get the data first, using the url mentioned in the doc here:

    docs.microsoft.com/.../using-events-api

    But when I do, I get a 400 error. Altough I do give the token to the url.

  • cloflyMao Profile Picture
    25,210 on at

    Hi John,

    It seems that you’re testing on a local machine? 

    In general, ng serve command will launch a lite server locally to run Angular app, and the protocol is http by default, could you confirm the URL starts with https when viewing event website?

    If everything have been configured well, please click Home link at top right, it will list all published events, open one of item to check whether a specific event could display.

    If issue still exists, a screenshot would be helpful.

    Regards,

    Clofly

  • cloflyMao Profile Picture
    25,210 on at

    To test Event API in Postman, we should always add emApplication=xxx at end of URL as authentication.

  • cloflyMao Profile Picture
    25,210 on at

    Hi John,

    I downloaded May release sample file and run event website successfully.

    I only edited environment.ts file, replaced apiEndpoint and emApplicationtoken with corresponding value in web application record.

    pastedimage1589547155873v1.png

    pastedimage1589547180969v2.png

    pastedimage1589547217785v3.png

    Could you share screenshot with issue?

    It would be glad that if we could solve your problem!

    Thanks,

    Clofly

  • Hedi Daneels Profile Picture
    487 on at

    Hi Clofly,

    First, thank you so much for taking the time for everything you do for this community!

    For the issue at hand, I started again, from scratch. Labels are in Dutch but you should recognize them.

    2086.png

    0447.png

    6204.png

    As you can see, it gives an error.

    Also, I have this problem in our SANDBOX AND in our production environment.

    EDIT: it seems this issue is only present in our SANDBOX? It works in production.

    Cheers

  • Verified answer
    cloflyMao Profile Picture
    25,210 on at

    Hi John,

    It could be caused by your sandbox environment if production env works.

    Due to I have only trial environment, please open a ticket for help if you need further assistance.

    https://admin.dynamics.com/?referer=mbssupport

    Regards,

    Clofly

  • Hedi Daneels Profile Picture
    487 on at

    I will open a ticket.

    Thanks again!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 70

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans