Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Answered

Failures after deploying Angular customizations into Event Management Portal

(0) ShareShare
ReportReport
Posted on by 115

We have a Portal hosted Event Management Portal (not a self hosted).

Then, we downloaded the last version of website (October 2020) from this link (https://docs.microsoft.com/en-us/dynamics365/marketing/developer/event-management-web-application#download-sample-event-website) and, without any customizations done, we were capable of serving that portal locally from localhost by using Node command prompt.

Before apply any changes, we wanted to know if we were able of deploy that portal by using the ps1 script provided with the source code, which is called DeployToDynamics365Instance.ps1. When running this, the console log repeated for each file this sequence: 

Updating file 1058.json
Updating webfile:
1058.json
Deleting annotations for the webfile, found 1 annotations
Updated file 1058.json

After running that however, if we let the environment.ts file like we have it when runnig in local host, we see a 404 error, because the requests are duplicating our site domain, like in this example:

Http failure response for https://ourSiteDomain/ourSiteDomainAgain/api/events/published/?ts=1604744790116: 404 Not Found

However, we assume that environment.ts has no implications in the event website running on internet. 

How and where can we change the configuration so our siteDomain were not replicated in the http request?

What are we doing wrong?

  • cloflyMao Profile Picture
    cloflyMao 25,202 on at
    RE: Failures after deploying Angular customizations into Event Management Portal

    Hi Manuel,

    Angular will compile all functions and modules to a single main.es, and it will read code from the file when web site is running.

    It is probably that when event website is running on portal, Angular already recognized entire URL of the current page as apiEndPoint value.

    (On portal server, '/' stands for xxx.microsoftcrmportals.com.)

    Then if we add URL of portal to apiEndPoint again, the end point would be duplicate.

    Unfortunately I can only give you suggestions because I haven't marketing application with portal enabled, what I owned is trial.

    Anyway, it is very glad that your problem has been solved.

    Regards,

    Clofly

    If you had found any answer helped, please kindly mark as verified to close the thread, it would be really appreciated.

  • Verified answer
    Manuesev Profile Picture
    Manuesev 115 on at
    RE: Failures after deploying Angular customizations into Event Management Portal

    Finally I found the solution.

    I do not why, but the apiEndpoint value that we had for locally running, was being uploaded into the compiled main.es file.

    What we have done is to manually download that main.es file from CRM and change the apiEndPoint value for '/' (portal binding was instead)

    Then, after saving, refresh the event page and the error dissapeared

  • cloflyMao Profile Picture
    cloflyMao 25,202 on at
    RE: Failures after deploying Angular customizations into Event Management Portal

    Hi Manuel,

    Try to set the apiEndPoint back to "/", then running deployment script again to check whether duplicate URL could be removed in the server.

    Also, make sure that the current environment.ts is modified from environment.d365.ts, because by default value of some of properties are different to environment.selfhosted.ts, these differences may also affect that whether deployment could work.

    In addition, you could also refer to following series of tutorials to check if anything is missing.

    https://community.dynamics.com/crm/b/misscrm360exploration/posts/tutorial-how-to-build-deploy-and-test-locally-dynamics-365-portal-or-dynamics-marketing-event-portal-and-connect-it-to-your-dynamics-365-instance-live-1670080455

    https://community.dynamics.com/crm/b/misscrm360exploration/posts/tutorial-customize-and-deploy-dynamics-365-marketing-event-management-or-other-portal

    Regards,

    Clofly

  • Manuesev Profile Picture
    Manuesev 115 on at
    RE: Failures after deploying Angular customizations into Event Management Portal

    Thanks for the quick answer Clofy!

    Yes 'ourSiteDomain ' refers to our event portal url. When deploying our portal code (whitout any customizations applied yet, just for update the version with the October 2020 base portal), we can see that this url duplicated in the http request, so we obtain an Http failure response with a 404 error. In localhost, we now that we can correct this error by changing the value for apiEndPoint variable in environment.ts, but here in the server we do not know where to look.

    We are capable of running the portal in our localhost, but when running the deployment script, although the operation do not crash, the site breaks with the mentioned error (we did not have to enable cross origin because we use a chrome extension that when enabled, supress this CORS policy errors,  but this should not affect our deployment, since this is only for local runnings).

    Regarding the deployment, there is not so much to do, since you only have to run the script. We do not know what is happening. 

    The only way we have to restore the portal, is by using Configuration Migration Tool to deploy the last release published of the sample event portal web site in this link https://docs.microsoft.com/en-us/dynamics365/marketing/developer/event-management-web-application#download-sample-event-website 

  • cloflyMao Profile Picture
    cloflyMao 25,202 on at
    RE: Failures after deploying Angular customizations into Event Management Portal

    Hi Manuesev,

    Is ourSiteDomain you mentioned the URL of your portal?

    Even if we have run the "npm install" command in the final step 5, there are still some extra actions necessary for us to take to run event website locally.

    1. In the environment.ts, was apiEndpoint property set the URL of your portal? and was useRestStack property set to false?

    Moreover, a trailing slash is required to be appended to the end of URL.

    7444.z1.JPG

    2. Have you bypassed the anti-CSRF token for local development?

    https://docs.microsoft.com/en-us/dynamics365/marketing/developer/portal-hosted#bypass-csrf

    3. You may also need to enable cross-origin resource sharing in Portal Management app to allow your localhost to access to Event API.

    https://docs.microsoft.com/en-us/dynamics365/marketing/developer/portal-hosted#configuring-cross-origin-resource-sharing-cors

    (Set value field of the site setting to http://localhost:4200/)

    Please make sure that the event website can run successfully on your local machine, then run the script to deploy customization.

    If you encounter any problem during deployment, please refer to my last answer in the following thread:

    https://community.dynamics.com/365/marketing/f/dynamics-365-for-marketing-forum/396613/how-can-i-insert-the-copywriting-privacy-statement-in-the-event-registration

    Regards,

    Clofly

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,836 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans