Skip to content
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

"Initialization Failed. No Parent window found." in desktop app #2533

Open
mfsysadmin opened this issue Sep 30, 2024 · 4 comments
Open

"Initialization Failed. No Parent window found." in desktop app #2533

mfsysadmin opened this issue Sep 30, 2024 · 4 comments

Comments

@mfsysadmin
Copy link

I have the following code from Microsoft Learn:

microsoftTeams.app.initialize().then(() => {
	getClientSideToken()
	.then((token) => {
		console.log(token);
	})
	.catch((error) => {
		console.log(error);
}).catch((error) => {
	console.log(error);
});
function getClientSideToken() {
	return new Promise((resolve, reject) => {
		microsoftTeams.authentication.getAuthToken().then((result) => {
			resolve(result);
		}).catch((error) => {
			reject("Error getting token: " + error);
		});
	});
}

Unfortunately on windows desktop app I get the following error: Error: Initialization Failed. No Parent window found.

Also in web app I have this error: Error: SDK initialization timed out.

Copy link
Contributor

Hi mfsysadmin! Thank you for bringing this issue to our attention. We will investigate and if we require further information we will reach out in one business day. Please use this link to escalate if you don't get replies.

Best regards, Teams Platform

@KangxuanYe
Copy link
Contributor

KangxuanYe commented Sep 30, 2024

Hi @mfsysadmin, thank you for reaching with the piece of code regarding of initialization on your app. Could you please follow the documentation in our wiki to turn on client logging and then share ALL of logs here so that we can have more detail to investigate what is exactly going on with your app and provide guidance for you?

Also, could you please elaborate more on which host platform (i.e. Teams web, Teams desktop) you are trying to make your app run on and what version of Teams-JS library you are using?

@mfsysadmin
Copy link
Author

Hi @KangxuanYe, in the webapp I have the following log messages:

teamsJs:app teamsjs is being used from https://cdn.jsdelivr.net/npm/@microsoft/[email protected]/dist/MicrosoftTeams.min.js. Today, teamsjs can only be used from a single script or you may see undefined behavior. This log line is used to help detect cases where teamsjs is loaded multiple times -- it is always written. The presence of the log itself does not indicate a multi-load situation, but multiples of these log lines will. If you would like to use teamjs from more than one script at the same time, please open an issue at https://github.com/OfficeDev/microsoft-teams-library-js/issues +0ms
teamsJs:communication:sendMessageToParentHelper Message 0 information: Object { actionName: "initialize", args: (3) […] } +0ms
Sending message 0 to parent via postMessage +0ms [common.js:113:9](webpack://microsoftTeams/node_modules/.pnpm/[email protected]/node_modules/debug/src/common.js)
teamsJs:validateOrigin isValidOriginsFromCDN call failed to validate origin: *.www.office.com +0ms
teamsJs:validateOrigin validOrigins fetch call to CDN failed with error: Error: Valid Origins List Is Invalid. Defaulting to fallback list +1ms

I use teams.microsoft.com, I don't know why it tries *.www.office.com
Also I don't really understand the last message since it makes a request to https://res.cdn.office.net/teams-js/validDomains/json/validDomains.json

On Teams web I have the "Error: SDK initialization timed out." message, while in the desktop app I have "Error: Initialization Failed. No Parent window found.".

@JE-Development
Copy link

JE-Development commented Oct 1, 2024

Hello, I also have this issue. It suddenly appeared with no code changed. (Windows Desktop Version)
I am using Teams Tab App. There I pasted my URL of my Vue.js project.
app.ts:56 Uncaught (in promise) Error: SDK initialization timed out. at un (app.ts:56:7) at e3.initialize (app.ts:774:12) at Proxy.created (SelectPage.vue:59:24) at callWithErrorHandling (runtime-core.esm-bundler.js:199:33) at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:206:17) at callHook (runtime-core.esm-bundler.js:3498:3) at applyOptions (runtime-core.esm-bundler.js:3416:5) at finishComponentSetup (runtime-core.esm-bundler.js:7878:7) at setupStatefulComponent (runtime-core.esm-bundler.js:7801:5) at setupComponent (runtime-core.esm-bundler.js:7729:36)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants