OfficeDev / teams-toolkit

Developer tools for building Teams apps
Other
453 stars 184 forks source link

Example apps don't work when deployed #12363

Open willlahr opened 1 week ago

willlahr commented 1 week ago

Describe the bug Building and then deploying the sample tab apps (react or minimal) don't work out of the box, there's an error "- error initializing application error cannot read properties of undefined (reading 'componentType')"

To Reproduce Steps to reproduce the behavior:

  1. Go to teams toolkit in vscode
  2. Click on '.Create new app'
  3. Choose 'Tab'
  4. Choose 'SPFx'
  5. Choose 'Create new SPFx solution'
  6. Choose 'Install the latest SPFx'
  7. Choose 'React' or 'minimal' (both lead to same result)
  8. Click 'provision' then 'deploy' then 'publish'
  9. Install app in teams
  10. Go to app in teams
  11. See error "There was a probelm"

Expected behavior Expected to see app work normally

VS Code Extension Information (please complete the following information):

CLI Information (please complete the following information):

Additional context Manually fixed this by changing:

File: package-solution.json Line 38: Original: "zippedPackage": "solution/example.sppkg" Fixed: "zippedPackage": "sharepoint/solution/example.sppkg"

HuihuiWu-Microsoft commented 1 week ago

Thanks @willlahr for reporting this to us. I'll try following your steps.

HuihuiWu-Microsoft commented 1 week ago

Hi @willlahr I tried but wasn't able to reproduce your issue. Actually the "zippedPackage": "solution/example.sppkg" field in package-solution.json is generated from SharePoint generator by default. Teams Toolkit doesn't do extra things to modify anything in package-solution.json. The path 'solution/example.sppkg' should be correct since packageDir defaults to ./sharepoint following the schema. Combining packageDir and zippedPackage will get "sharepoint/solution/example.sppkg" if user didn't modify default value of packageDir field.

If the app doesn't work normally with "zippedPackage": "solution/example.sppkg", could you help try to debug in SharePoint workbench to see whether the issue persist outside of Teams environment?

willlahr commented 5 days ago

Thanks for looking into it.
I can confirm that the apps work fine locally, the problem is only:

HuihuiWu-Microsoft commented 5 days ago

@willlahr Could you help check where your package is generated(is it under .\src\sharepoint\solution or .\src\sharepoint\sharepoint\solution)? If there's sppkg under .\src\sharepoint\solution, please remove the existing package and deploy again(with original zippedPackage path) to generate a new one and see whether you still have the issue.