OfficeDev / microsoft-teams-apps-champion-management

Champion Management Platform is a custom Teams app that enables organizations to onboard and maintain champions/ SME in their organization in Teams.
MIT License
125 stars 48 forks source link

Error: "Cannot read properties of undefined (reading 'id')" when opening the app for the first time #194

Closed Malte-BNT closed 2 months ago

Malte-BNT commented 3 months ago

As SharePoint Admin, we installed CMP v2.5 to the tenant-wide SharePoint App catalog, enabled it for all Sites and Teams (and published to Teams), then approved the required API permissions as Global Admin. Teams App "Champion Management Platform" is available for install, so a non-admin user installed it in personal scope. When opening the app (for the first time), it only renders an error message (see below). That said, we are not getting to the initial screen with the spinner (while site/lists get created).

Something went wrong
If the problem persists, contact the site administrator and give them the information in Technical Details.
TECHNICAL DETAILS
ERROR:
Cannot read properties of undefined (reading 'id')

CALL STACK:
TypeError: Cannot read properties of undefined (reading 'id')
    at https://res-1.cdn.office.net/files/sp-client/teams-web-part-application-assembly_en-us_b2479fff0532f5aec35976ff8e0b39fe.js:125:12346
    at new Promise (<anonymous>)
    at e.loadComponent (https://res-1.cdn.office.net/files/sp-client/teams-web-part-application-assembly_en-us_b2479fff0532f5aec35976ff8e0b39fe.js:125:12314)
    at https://res-1.cdn.office.net/files/sp-client/teams-web-part-application-assembly_en-us_b2479fff0532f5aec35976ff8e0b39fe.js:125:14535
    at async Promise.all (index 0)

The same happens when opening the app in either Teams Web Client (browser: https://teams.microsoft.com) and SharePoint (adding the app as a web part to a page). At least on SharePoint, we tried again with a user account being a SharePoint Admin. We can't use Teams with that same account - no Teams license assigned. Not sure if this is a requirement, but to my understanding, it is not (users are allowed to create SharePoint sites through API, script, etc.).

The web version of the Teams Client exposed several stack traces, I attached those (replacing and tenant references with "removed). teams.microsoft.com-1712243717399.log

Hope that helps you to guide us where to look at.

Thanks, Malte

v-saikirang commented 3 months ago

Hi @Malte-BNT,

Thanks for reaching out to us.

As mentioned in the deployment guide, please try opening the app with a global admin account. If you still face issues please check the below:

1) check if SharePoint site "championmanagementplatform" is created. 2) please share screenshot the error you see when running the app. 3) share a screenshot of the API permissions page. 4) if the SharePoint site is created share a screenshot of the site contents page

Thanks.

Malte-BNT commented 3 months ago

Hi @v-saikirang,

thanks for the fast reply.

I installed the Teams App with a user being Global Admin now, but still: when opening the App with that Global Admin user account, it displays the above error message (screenshot attached as well, now) before rendering anything.

I checked the following (screenshots attached):

  1. SharePoint site "championmanagementplatform" is not created (searched for it in SharePoint Admin Center)
  2. Screenshot of the error message attached
  3. SharePoint API permission page (screenshot attached)
  4. no site created yet

image image image image

Malte

v-saikirang commented 3 months ago

Thanks for sharing the information. We will look in to the logs and get back to you.

Thanks.

v-saikirang commented 2 months ago

Hi @Malte-BNT,

I could not find anything in the logs to help with the issue. Can you please a re install by following the instructions.

  1. Delete the App from Teams
  2. Delete 'ChampionManagementPlatform' SharePoint site from both 'Active Sites' and 'Deleted Sites' from SharePoint admin center.
  3. Delete the package from App catalog
  4. Wait for 15-30 mins to clear the cache related issues.
  5. Re upload the package to app catalog and deploy and sync to Teams. Ensure to approve the API permissions (User.ReadWrite, Sites.Manage.All) in SP admin center.
  6. Install the App in Teams using the same tenant admin account.
  7. Wait until you see the alert with the success message "{loggedinuser} has been added as a manager to the Champion Management Platform, please refresh the app to complete the setup."
  8. Provide required access in the "ChampionManagementPlatform" SharePoint site for other users to access the app. Thanks.
Malte-BNT commented 2 months ago

Hi @v-saikirang, it actually works now after uninstalling then reinstalling the two packages (cmp, mgt-spfx-vv3). Sorry for not running through the general "try again" loop myself in the first place :-( Malte