Open joaquinlefebvre opened 9 months ago
We recently encountered this problem as well; we are using Vue2 and typescript.
A colleague did include an AppDomain entry in the manifest like
<AppDomain>https://localhost:3000</AppDomain>
and after 'forcing' the reload of the sideloaded add-in (clearing of cache, F5 refresh, etc) the problem did disappear.
We recently encountered this problem as well; we are using Vue2 and typescript.
A colleague did include an AppDomain entry in the manifest like
<AppDomain>https://localhost:3000</AppDomain>
and after 'forcing' the reload of the sideloaded add-in (clearing of cache, F5 refresh, etc) the problem did disappear.
Thank you very much @neville-jones. We did the same and it seems to have worked. It's more about updating the documentation or so I don't know if this is really an issue or a new feature. Maybe you should ask Microsoft so that other people don't run into the same problem.
Again, thank you very much. By adding https://localhost:3000/ to the manifest in the AppDomains key and clearing all LocalStorage data I was able to display the dialog as expected.
@joaquinlefebvre We are checking this internally to confirm if it's bug or documentation gap.
Open dialog with localhost throws Error 12004.
Your Environment
Platform [PC desktop, Mac, iOS, Office on the web]: Office on the web Host [Excel, Word, PowerPoint, etc.]: Outlook Office version number: modern Outlook UI Operating System: Windows Browser: Chrome
Expected behavior
Open a dialog on an IFrame when domain is https://localhost
It was working fine until today. (Or at least the last two days).
When call this function:
With this parameters:
A dialog with the content of this url: 'https://localhost:3000/login.html' is shown in an IFrame as expected.
Current behavior
The dialog is not showing and a javascript error is thrown:
12004 | The domain of the URL passed to displayDialogAsync is not trusted. The domain must be the same domain as the host page (including protocol and port number).
We also try to add https://localhost and https://localhost:3000 on AppDomain key on manifest.xml but the result is the same error.
(https://learn.microsoft.com/en-gb/javascript/api/manifest/appdomain?view=common-js-preview)
Aditional comment
In this url: https://learn.microsoft.com/en-gb/javascript/api/manifest/appdomain?view=common-js-preview we can read on point 4:
Listing the same domain as the one specified in the [SourceLocation element](https://learn.microsoft.com/en-gb/javascript/api/manifest/sourcelocation?view=common-js-preview) has no effect and may be misleading. In particular, when you are developing on localhost, you don't need to create an <AppDomain> element for localhost.
Steps to reproduce
import { FluentProvider, webLightTheme } from "@fluentui/react-components"; import App from "./components/App";
/ global document, Office, module, require /
const title = "Contoso Task Pane Add-in";
const rootElement: HTMLElement = document.getElementById("container"); const root = createRoot(rootElement);
/ Render application after Office initializes / Office.onReady(() => { root.render(
); });
if ((module as any).hot) { (module as any).hot.accept("./components/App", () => { const NextApp = require("./components/App").default; root.render(NextApp); }); }
interface AppProps { title: string; }
const useStyles = makeStyles({ root: { minHeight: "100vh", }, });
const App = (props: AppProps) => { const styles = useStyles(); // The list items are static and won't change at runtime, // so this should be an ordinary const, not a part of state. const listItems: HeroListItem[] = [ { icon: ,
primaryText: "Achieve more with Office integration",
},
{
icon: ,
primaryText: "Unlock features and functionality",
},
{
icon: ,
primaryText: "Create and visualize like a pro",
},
];
function showLogin() { const url = new URI(
login.html
).absoluteTo(window.location.toString()).toString();}
return (
); };
export default App;
Inside entry key:
And this code inside plugins key:
Context
With a localhost domain is not working, but when we execute same code with a valid domain, is working fine.
Useful logs