Closed MorrisPenasso closed 1 year ago
I have a similar issue. I thought I was my setup but since last month I am not able to debug the "onMessageSendHandler" as well. I receive this window message when I setup the regedit key, and start the debugger following all the steps mentioned on the documentation, but the debugger doesn't do anything.
Environment:
Same scenario explained above , the only difference it's that my backend it's setup on .NET and I call the endpoints on the base route https://localhost:44306.
In my case I am just trying to execute different endpoints when you hit "Send" inside the launcheevent.js. E.g. GET, POST, etc.
And to avoid syntax errors I tested before all these endpoints from the (1) add-in codebase, (2) Scrip-lab and (3) Postman and all worked fine. This issue only happens inside onMessageSendHandler, on the launchevent.js file.
I think this is a CORS issue related to the way we setup the back-end in .NET. I am receiving a "Network request failed" on the catch {} and this usually happens when we don't setup our URL in the CORS config key on our backend. I ran similar example on Script-lab, and I fix it just adding the script lab URL to my backend CORS config key. E.g.
Note: Also, I tried what was mentioned on other chats to add the microsoft-officeaddins-allowed inside the .wellknow folder. But this doesn't fixed the problem as well.
How I can add the launchevent.js or bundle.js files to my CORS config URLs when running this on dev-enviroment - localhost:3000, or there is any workaround for this?
Hi Office dev team, any updates in any of these issues?
Hi @MorrisPenasso and @hapalacios, thanks for letting us know about this issue. @exextoc can you please help resolve this issue? Thanks!
Can you please verify if the steps mentioned in documentation - https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/debug-autolaunch#attach-visual-studio-code are followed.
I followed only steps mentioned in documentation.
@MorrisPenasso Is the OnMessageSend event working as expected? Please confirm if my understanding is correct. The launch event works fine but it doesn't stop at breakpoint.
Exactly. On my example, with the istruction "event.completed({allowEvent: true})", the email is sended. But it doesn't stop at breakpoint.
Exactly the same for me @exextoc. I have two scenarios: 1) If I don't add any endpoint call on launchevent.js, the email it's sent and doesn't stop at the breakpoint. 2) If I add a endpoint call like the one explained on my example above, the email it's not sent, and I receive a "Network request failed" on the catch {} . Also in this example the debugger doesn't stop at the breakpoint.
Can you please verify if the steps mentioned in documentation - https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/debug-autolaunch#attach-visual-studio-code are followed.
I also followed these steps.
Hi @exextoc . Any updates on any of these issues? I am delaying this kind of functionality from my current release plan. Right now, I am not suffering a big impact, but in one week, if I am not able to call endpoints and run the debugger inside the launcheenevent.js file I will need to look to other solutions.
There are other methods ? I would like to debug my launchevent.ts for understand how to import another typescript modules.
I will not recommend to do imports inside launchevent.js. That practice it's not recommended on the documentation. Not sure if this is what you are looking for?
If you are looking into testing more events you have a list here: https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/autolaunch?tabs=xmlmanifest
My typescript modules is used for work with custom actions behind a buttons and when i send an email/appointment. I can't repeat the code for using behind button and for events. The debug is important in my case.
Any updates???
@exextoc any updates on these issues?
@MorrisPenasso and @hapalacios, in your launch.json
file, can you replace 9229 with 9223 and see if that works?
Perfect! It works!!!
@exextoc thanks for your help!!
@exextoc I was already using 9223 on my previous testing. The debugger it's working when adding breakpoints on the "onMessageComposeHandler" but not for the "onMessageSendHandler". I am going to do a little bit more of testing with simpler functions tomorrow.
@exextoc I can confirm onMessageSendHandler breakpoints work for simple functions, but not for complex functions that includes:
I am going to continue testing later today. BTW did you check the other issue I reported on my first couple of messages above, related to CORS for the bundle.js file. Right now, I am receiving network error.
@hapalacios Can you open separate issues so that we can them track differently? @MorrisPenasso I'm glad the port change addressed this for you. We are going to update our documentation to reflect this.
Sure @exextoc . I will create two simple scenarios and remove the extra complexity so you can test as well.
@hapalacios Was you able to send fetch request from launchevent.js? For me it does not work in Outlook 365, network request failed and debugger endpoints are not hit as well
This might be an issue related to CORS or the well-known URI. See https://github.com/OfficeDev/office-js/issues/3907#issuecomment-2023138415
Provide required information needed to triage your issue
I developing a Outlook Addin on Typescript and with old event "onSend" it work but i can't deploy on AppSource. So i use "OnMessageSend" event. When i try to start debugger, is not attached.
Your Environment
Expected behavior
I would like to use debugger on visual studio code before email is sended.
Current behavior
Below there are the steps:
Open Visual studio code
Launch the build of my addin ( on my package.json, the build command is: "webpack --mode production" )
On the terminal, launch this command: "npm install" ( on my package.json, the start command is: "office-addin-debugging start manifest.xml ")
Sideload my plugin on Outlook
Write a new email and when i click on send button, i see this window:
I return on Visual Studio Code, open bundle.js file on this path: "C:\Users\myuser\AppData\Local\Microsoft\Office\16.0\Wef{2B0491B8-BEC1-4AE1-82D6-95903FC6B345}\L_ouAUlOeq_L4_AsbTReQQ==\Javascript\c208ed5a-7425-4e99-ac52-eb9e74a04d1d_1.0.0.0_it-IT" and set breakpoint.
Launch "Direct Debugging" launcher. On launch.json file, is set on this mode:
The debugger is not attached. Why ?
Return into Outlook and press "Ok".
The debugger not start.
Link to live example(s)
Below, my code:
on my manifest.xml file:
On my launchevent.ts:
Useful logs