-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App hungs up: global is not defined #2639
Comments
@karamem0 -Thank you for your inquiry about your Teams app development issue! To assist you better, could you please provide the following details?
This information will help us better understand the situation and provide a more accurate response. |
Same here with @microsoft/teams-js 2.31.1 2.31.1 is not usable at the moment |
Same problem in our vue project. |
Hi. While we are actively looking into this issue, we believe version 2.31.0 should work without this issue. Could you please try out that version in the meantime and let us know if you are continuing to run into the issue. |
2.31.0 works. I assume the bug was introduced by packages/teams-js/jest-setup.cjs. |
Adding |
Hi all, we've put out a beta release which should resolve the issues you're having. Please try it out and let us know if you continue to run into any issues. Thanks! |
Same issue here. How long until master is tagged with the fix? |
This has another issue: |
Hi @victordas, we are aware of this issue and working on a fix. @atymic the next main release to go out will be early next week as we have a company wide release freeze this week for the holidays. I'll be sure to keep this thread updated when it goes out. |
Hi all, we have a beta release out, v2.32.0-beta.2, which should contain the fixes for both issues mentioned in the thread. Please try it out and let us know if you are continuing to see any issues. |
|
Thank you @victordas for letting us know. This issue stems from polyfill code in a 3rd party library that we do not own unfortunately, so it may take us some time to come up with a shippable fix that lives in our codebase. In the meantime, I believe adding
to your |
I get the following error with those changes Here's my
|
Hi all. v2.32.0-beta.3 has been released and should resolve this issue. Once again, please try it out and let me know if you continue to see ongoing issues and I appreciate everyone's patience while we deal with this rather tricky issue. |
Unfortunately it doesn't look like v2.32.0-beta.3 has fixed this problem:
Loading the app still results in the same error:
2.31.0 works ok. |
Hi @adamreisnz, Thank you for the info. Just to clarify, did you also implement the workaround changes to your vite.config outlined in this comment alongside v2.23.0-beta-3. |
Ah, thanks @noahdarveau-MSFT , I missed that comment. It appears to work with 2.23.0 and that specific Vite config now, thank you 🎉 |
It works for me too. |
Actually, while it works in dev, when I use Vite to build for production, the suggested I will revert the version again for now. |
Hi @adamreisnz. Interesting that it is working for you in dev but, the issue continues to persist in prod. Since we are getting reports from other package consumers that the issue is resolved for them, could you please do some investigation on your end as to why this issue is persisting for you in prod, but not in dev. Thanks. |
Hello @noahdarveau-MSFT , I have created a minimal reproduction repo for you here: https://github.com/adamreisnz/teams-js-reproduction Reproduction is easy:
The app works fine in Vite dev mode, but when building for production and trying to run that, it displays the same error. I don't know why other teams are reporting that it is working. Perhaps they did not try to deploy to production yet over the holidays 😉 Hope this helps you reproduce it on your end. |
I'm very new to vite, but poking around in their documentation and on stack overflow it sounds like the One suggestion I'm seeing that might be interesting (from https://stackoverflow.com/a/73208485): The problem is because vite doesn't define a global field in window as webpack does. And some libraries relies on it since webpack is much more older than vite. Just insert at the very start, before any library import: // init.js
window.global ||= window; A good way to have the above code before any import is to write in new file, let's call it init.js, and import it as first. // in index.js or main.js file
import "./init"
// import your app and libraries after...
import App from './App'
import ... After playing around with this for a few minutes I haven't yet gotten it to work (although that could have been my inexperience with vite). I'll keep playing with this, but could you try something like that and see if it works? (Btw if you are curious it seems like the root problem is that we provide a polyfill of the buffer package, and that polyfill assumes that global has been defined, which vite does not do by default) |
Version
Description
I got an error when I update
@microsoft/teams-js
version from2.23.0
to2.31.1
.The text was updated successfully, but these errors were encountered: