VSCode - debugging an iframe inside a web application with vscode-chrome-debug - debugging

Using the latest VS Code and the excellent Chrome Debug extension.
I have one site that I can't get debugging to work and it's because the code I want to debug is in an iframe. Just running the page in the frame won't work for me (because auth and postMessage and more).
The folder structure in Chrome DevTools looks like the following: http://imgur.com/2VLjD1j. I want to debug the wfm folder selected, which is what I have open in VSCode.
The mapping as hosted by the web server is (though I can't hit this directly - this is what Chrome maps to if I try to use their workspace->code automap):
https://localhost:4300/contact-center/components/wfm
I don't see any way to tell the plugin that I want to debug this iframe in launch.json, but for completeness here's what I have so far:
{
"name": "Launch with sourcemaps",
"type": "chrome",
"request": "launch",
"url": "https://localhost:4300/dca",
"sourceMaps": true,
"userDataDir": "/Users/${env.USER}/Library/Application\\ Support/Google/ChromePersonal",
"webRoot": "${workspaceRoot}"
}

Hah, it's been 5 years! I faced the same problem and switched to using VS Code Debugger for Firefox to debug an Outlook add-in.
.vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "firefox",
"request": "attach",
"name": "Firefox: Attach",
"webRoot": "${workspaceFolder}/src",
"url": "https://addin.example.com",
"tabFilter": "https://outlook.office.com/*",
"preLaunchTask": "Firefox debugger",
"pathMappings": [
{
"url": "webpack:///",
"path": "${webRoot}/"
},
{
"url": "webpack://./",
"path": "${webRoot}/"
},
{
"url": "webpack:///**",
"path": "${workspaceFolder}/src"
},
{
"url": "webpack:///node_modules/",
"path": null
}
],
"skipFiles": [
"chrome://**",
"moz-extension://**",
"**/node_modules/**"
],
"log": {
"consoleLevel": {
"PathConversion": "Error",
"SkipFilesManager": "Error",
"DebugConnection": "Error",
"ThreadActorProxy": "Error",
"TabActorProxy": "Error",
"SourceMappingThreadActorProxy": "Error",
"SourceActorProxy": "Error",
"net": "Error",
"ConsoleActorProxy": "Error",
"ConsoleActor": "Error",
"FirefoxDebugSession": "Error",
"FirefoxDebugAdapter": "Error",
"RootActorProxy": "Error",
"TabDescriptorActorProxy": "Error",
"DataBreakpointsManager": "Error",
"BreakpointsManager": "Error",
"SourceAdapter": "Error",
"SourceMappingSourceActorProxy": "Error",
"SourceMappingInfo": "Error",
"ThreadPauseCoordinator": "Error",
"FrameActorProxy": "Error",
"ObjectGripActorProxy": "Error",
"ThreadCoordinator": "Error",
"default": "Debug"
}
}
}
]
}
"preLaunchTask": "Firefox debugger" - comes from .vscode/tasks.json
"url": "https://addin.example.com" - iframe's URL
"tabFilter": "https://outlook.office.com/*" - instructs to search iframe in specific tabs
.vscode/tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "Firefox debugger",
"osx": {
"type": "shell",
"command": "/Applications/Firefox.app/Contents/MacOS/firefox --start-debugger-server"
},
"windows" : {
"type": "shell",
"command": "\"C:\\Program Files\\Mozilla Firefox\\firefox.exe\" -start-debugger-server"
}
}
]
}

Related

Manifest parsing error when trying to test app in Teams

From https://dev.teams.microsoft.com/, whenever I click "Preview in Teams", it shows an error in Teams with these details copied to the clipboard: "Error while reading manifest.json". If I download the app package and "upload a custom app" I get the same error. What can I do to resolve this? If I remove the messaging extension configuration, it works but I configured that part in their app and that's what I want to build.
This is my manifest file:
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.11/MicrosoftTeams.schema.json",
"version": "1.0.0",
"manifestVersion": "1.11",
"id": "3fXXXX",
"packageName": "com.package.name",
"name": {
"short": "Domo Integration",
"full": ""
},
"developer": {
"name": "Domo Inc.",
"mpnId": "",
"websiteUrl": "https://www.domo.com",
"privacyUrl": "https://www.domo.com/company/privacy-policy",
"termsOfUseUrl": "https://www.domo.com/company/service-terms"
},
"description": {
"short": "short",
"full": "full"
},
"icons": {
"outline": "outline.png",
"color": "color.png"
},
"accentColor": "#FFFFFF",
"composeExtensions": [
{
"botId": "deXXXXXXXX",
"commands": [],
"canUpdateConfiguration": true,
"messageHandlers": [
{
"type": "link",
"value": {
"domains": [
"*.domo.com"
]
}
}
]
}
],
"validDomains": [
"*.domo.com"
]
}
#ccnokes In order to use messaging extension in your bot, you need to provide at least one command. commands is required property in composeExtension - see doc.
I was also getting the same error when tried with your manifest but after adding commands it worked totally fine.

VS Code Debugger doesn't work - Error processing "breakpointLocations": Error: Script not found

Debugger doesn't work on vue application(javascript). I put the breakpoints in the component part, but it doesn't work
launch.json: (for Debugger for Chrome)
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "vuejs: chrome",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}/src",
"breakOnLoad": true,
"sourceMapPathOverrides": {
"webpack:///src/*": "${webRoot}/*"
}
}
]
}
terminal:
Error processing "breakpointLocations": Error: Script not found
at Client.processMessage (/home/user/.vscode/extensions/msjsdiag.debugger-for-chrome-4.12.8/node_modules/noice-json-rpc/lib/noice-json-rpc.js:66:36)
at LoggingSocket.<anonymous> (/home/user/.vscode/extensions/msjsdiag.debugger-for-chrome-4.12.8/node_modules/noice-json-rpc/lib/noice-json-rpc.js:42:48)
at LoggingSocket.emit (events.js:208:15)
at Receiver.receiverOnMessage (/home/user/.vscode/extensions/msjsdiag.debugger-for-chrome-4.12.8/node_modules/ws/lib/websocket.js:789:20)
at Receiver.emit (events.js:203:13)
at Receiver.dataMessage (/home/user/.vscode/extensions/msjsdiag.debugger-for-chrome-4.12.8/node_modules/ws/lib/receiver.js:422:14)
at /home/user/.vscode/extensions/msjsdiag.debugger-for-chrome-4.12.8/node_modules/ws/lib/receiver.js:379:23
at /home/user/.vscode/extensions/msjsdiag.debugger-for-chrome-4.12.8/node_modules/ws/lib/permessage-deflate.js:298:9
at /home/user/.vscode/extensions/msjsdiag.debugger-for-chrome-4.12.8/node_modules/ws/lib/permessage-deflate.js:376:7
at afterWrite (_stream_writable.js:484:3)
I edited launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "vuejs: chrome",
"port": 9222,
// "url": "http://localhost:8080",
"webRoot": "${workspaceFolder}/src",
"urlFilter": "http://localhost:8080/*"
/*"breakOnLoad": true,
"sourceMapPathOverrides": {
"webpack:///src/*": "${webRoot}/*"
}*/
}
]
}
and open in browser new tab - about:blank, after click on it in CALL STACK row, and open localhost:8080 in this(about:blank) tab

VS Code, GDB remote debugging and Linux/Windows path characters

Simple question I hope. I'm using VS Code with the C/C++ extension running on Windows for remote debugging an ARM Cortex M0 board via OpenOCD running on Linux. This all works wonderfully well, with a single exception: path characters.
The problem is the ${workspaceFolder} macro. Since VS Code is running on Windows it seems to always use \ as a path delimiter. See error picture below. Obviously hardcoding the full path using / works but makes the launch.json highly machine specific.
Anyone know how to remap the path character?
TAIA.
launch.json for anyone who wants a working reference:
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "cppdbg",
"request": "launch",
"logging": { "engineLogging": true },
"program": "R:/src/embedded/mcuxpresso/ASCH5_LPC/flash/ASCH5_LPC.axf",
"stopAtEntry": false,
"miDebuggerPath": "r:/apps/gcc-arm/bin/arm-none-eabi-gdb.exe",
"MIMode": "gdb",
"targetArchitecture": "arm",
"launchCompleteCommand": "exec-run",
"setupCommands": [
{ "text": "-target-select remote 192.168.1.99:3333", "description": "connect to target", "ignoreFailures": false },
{ "text": "-file-exec-and-symbols R:/src/embedded/mcuxpresso/ASCH5_LPC/flash/ASCH5_LPC.axf", "description": "load file", "ignoreFailures": false}, // this works
//{ "text": "-file-exec-and-symbols ${workspaceFolder}/flash/ASCH5_LPC.axf", "description": "load file", "ignoreFailures": false}, // this does not ...
{ "text": "-interpreter-exec console \"monitor reset\"", "ignoreFailures": false },
{ "text": "-interpreter-exec console \"monitor halt\"", "ignoreFailures": false },
{ "text": "-interpreter-exec console \"monitor arm semihosting enable\"", "ignoreFailures": false },
],
"externalConsole": true,
"cwd": "${workspaceFolder}"
}
]
}

Visual Studio Code Python Debugger Windows

I seem to be missing something simple, but I can't figure out why I am unable to debug python using Visual Studio Code on Windows. I've tried setting up the debugger as shown by Microsoft, and this youtube video. I've done a clean install of Visual Studio Code (including the python extension) and Python 3.6. I have no other python versions installed. I keep getting the following errors in the Python Debugger:
cd "c:\Users\xxx\Documents\Python Scripts" ; env "PYTHONIOENCODING=UTF-8" "PYTHONUNBUFFERED=1" "C:\Users\xxx\AppData\Local\Programs\Python\Python36-32\python.exe" "C:\Users\xxx\.vscode\extensions\ms-python.python-2018.3.1\pythonFiles\PythonTools\visualstudio_py_launcher.py" "c:\Users\xxx\Documents\Python Scripts" 53746 34806ad9-833a-4524-8cd6-18ca4aa74f14 RedirectOutput,RedirectOutput "c:\Users\xxx\Documents\Python Scripts\.vscode\launch.json"
-bash: cd: c:\Users\xxx\Documents\Python Scripts: No such file or directory
env: ‘C:\\Users\\xxx\\AppData\\Local\\Programs\\Python\\Python36-32\\python.exe’: No such file or directory
It's complaining that it can't find the python.exe file, but it clearly can since VS code indicates that it's attached:
My launch.json file is the default, and I've tried all the configurations:
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}"
},
{
"name": "Python: Attach",
"type": "python",
"request": "attach",
"localRoot": "${workspaceFolder}",
"remoteRoot": "${workspaceFolder}",
"port": 3000,
"secret": "my_secret",
"host": "localhost"
},
{
"name": "Python: Terminal (integrated)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "Python: Terminal (external)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "externalTerminal"
},
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"runserver",
"--noreload",
"--nothreading"
],
"debugOptions": [
"RedirectOutput",
"Django"
]
},
{
"name": "Python: Flask (0.11.x or later)",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "${workspaceFolder}/app.py"
},
"args": [
"run",
"--no-debugger",
"--no-reload"
]
},
{
"name": "Python: Module",
"type": "python",
"request": "launch",
"module": "module.name"
},
{
"name": "Python: Pyramid",
"type": "python",
"request": "launch",
"args": [
"${workspaceFolder}/development.ini"
],
"debugOptions": [
"RedirectOutput",
"Pyramid"
]
},
{
"name": "Python: Watson",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/console.py",
"args": [
"dev",
"runserver",
"--noreload=True"
]
},
{
"name": "Python: All debug Options",
"type": "python",
"request": "launch",
"pythonPath": "${config:python.pythonPath}",
"program": "${file}",
"module": "module.name",
"env": {
"VAR1": "1",
"VAR2": "2"
},
"envFile": "${workspaceFolder}/.env",
"args": [
"arg1",
"arg2"
],
"debugOptions": [
"RedirectOutput"
]
}
]
}
Pylinting works fine, and I have not custom user settings in Visual Studio Code that are related to python. I've tried setting the complete file path to python.exe in settings.json but it makes no difference.
Any help is greatly appreciated. Thanks in advance
I had the same problem but finally got out of it after several adjustment to my settings.
make sure all other settings are in place as you've mentioned especially pythonPath in settings.json and also get "python" installed from the "extension" toolbar in VS code.
Simply change your debug configuration from "Python: Scripts" (or any other configuration you've selected previously) to "Python: Terminal(external)" and you are good to go!
I know, is a pain and I'm experiencing the same.
Apparently python.exe is executing correctly. You will keep seeing that banner because "This is necessary to bootstrap the debugger."
At least this is what Microsoft says.

Compounds debugging in VS Code with delayed launch

I'm trying to launch multiple programs that need to talk to each other in the debugger in VS Code and created a launch.json with a compound that launches each of the executables. The programs launch simultaneously and all try to connect to the host at the same time. Is there any way in VS Code to explicitly set some sort of time delay between launch of each of the executables, say 250ms or so?
{
"version": "0.2.0",
"configurations": [
{
"name": "Host",
"type": "cppdbg",
"request": "launch",
"program": "/home/user/build/bin/host",
"args": [],
"stopAtEntry": false,
"cwd": "/home/user/build/bin",
"environment": [],
"externalConsole": true,
"linux": {
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
},
{
"name": "Node A",
"type": "cppdbg",
"request": "launch",
"program": "/home/user/build/bin/Node_A",
"args": ["ArgA", "ArgB", "ArgC"],
"stopAtEntry": false,
"cwd": "/home/user/build/bin",
"environment": [],
"externalConsole": true,
"linux": {
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
},
{
"name": "Node B",
"type": "cppdbg",
"request": "launch",
"program": "/home/user/build/bin/Node_B",
"args": ["ArgA", "ArgB", "ArgC"],
"stopAtEntry": false,
"cwd": "/home/user/build/bin",
"environment": [],
"externalConsole": true,
"linux": {
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
}
],
"compounds": [
{
"name": "System",
"configurations": ["Host", "Node A", "Node B"]
}
]
}
Yes, you can add a prelaunch task which will sleep for x seconds.
So say you have a client and server on Node.js and the server db connection takes longer to load this causes problems with the client.
Delaying the client debugger on vscode would work like this on a Mac OS X
First create a task in the same folder as the launch.json file called tasks.json which will build out a shell command before launching the client.
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Sleepdelay",
"type": "shell",
"command": "sleep 6",
"windows": {
"command": "ping 127.0.0.1 -n 6 > nul"
},
"group": "none",
"presentation": {
"reveal": "silent",
"panel": "new"
}
}
]
}
Add the following pretask to your launch.json file now to call the task
{
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Client",
"url": "http://localhost:9090",
"webRoot": "${workspaceFolder}/client/src",
"breakOnLoad": true,
"sourceMapPathOverrides": {
"webpack:///./src/*": "${webRoot}/*"
},
"preLaunchTask": "Sleepdelay"
//"runtimeExecutable": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
},
{
"type": "node",
"request": "launch",
"name": "Server",
"program": "${workspaceFolder}/server/server.js",
"envFile": "${workspaceFolder}/server/.env",
"cwd": "${workspaceFolder}/server/"
}
],
"compounds": [
{
"name": "Server/Client",
"configurations": ["Server", "Client"]
}
]
}
The sleep command is available on Linux and MAC OS X. For Windows just use this hack in place of it:
ping 127.0.0.1 -n 6 > nul
Now you have a simple method to delay the launch of the client before the server.
Complementing Jason's answer
I was getting Error
OpenError: (:) [Out-File], NotSupportedException FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand
On Windows (PowerShell Terminal), and have to change the ping hack command from:
"ping 127.0.0.1 -n 6 > nul"
to:
"ping 127.0.0.1 -n 6 > $null"

Resources