Skip to content

Commit 4e3f3b1

Browse files
committed
add bookmarklet
1 parent fd7e7ed commit 4e3f3b1

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ and paste it into Chrome.
127127
```chrome-devtools://devtools/remote/serve_file/@60cd6e859b9f557d2312f5bf532f6aec5f284980/inspector.html?experiments=true&v8only=true&ws=[DEBUGGER_BROKER_ADDRESS]:9229/[DEBUGGER_FUNCTION_ID]```
128128
3. DEBUG!!!
129129

130+
**Bonus!** Use this bookmarklet to pull the URL from the Code tab for the function in the AWS console:
131+
132+
```
133+
javascript:(function()%7Bconst obj %3D %7B%7D%3B document.querySelectorAll('.env-var-list .key-value').forEach(elem %3D> %7B if (elem.querySelectorAll('input%5Bplaceholder%3D"Key"%5D').item(0).value) obj%5Belem.querySelectorAll('input%5Bplaceholder%3D"Key"%5D').item(0).value%5D %3D elem.querySelectorAll('input%5Bplaceholder%3D"Value"%5D').item(0).value %7D)%3B const win %3D window.open(''%2C '_blank')%3B win.document.write(%60Debugger URL%3A chrome-devtools%3A%2F%2Fdevtools%2Fremote%2Fserve_file%2F%4060cd6e859b9f557d2312f5bf532f6aec5f284980%2Finspector.html%3Fexperiments%3Dtrue%26v8only%3Dtrue%26ws%3D%24%7Bobj.DEBUGGER_BROKER_ADDRESS%7D%3A9229%2F%24%7Bobj.DEBUGGER_FUNCTION_ID%7D%60)%7D)()
134+
```
135+
130136
## What's the catch?
131137

132138
There are a few catches/known issues:

bookmarklet.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// source
2+
const obj = {};
3+
document.querySelectorAll('.env-var-list .key-value')
4+
.forEach(elem => {
5+
if (elem.querySelectorAll('input[placeholder="Key"]').item(0).value)
6+
obj[elem.querySelectorAll('input[placeholder="Key"]').item(0).value] = elem.querySelectorAll('input[placeholder="Value"]').item(0).value });
7+
const win = window.open('', '_blank');
8+
win.document.write(`Debugger URL: chrome-devtools://devtools/remote/serve_file/@60cd6e859b9f557d2312f5bf532f6aec5f284980/inspector.html?experiments=true&v8only=true&ws=${obj.DEBUGGER_BROKER_ADDRESS}:9229/${obj.DEBUGGER_FUNCTION_ID}`);
9+
10+
/* bookmarklet:
11+
javascript:(function()%7Bconst obj %3D %7B%7D%3B document.querySelectorAll('.env-var-list .key-value').forEach(elem %3D> %7B if (elem.querySelectorAll('input%5Bplaceholder%3D"Key"%5D').item(0).value) obj%5Belem.querySelectorAll('input%5Bplaceholder%3D"Key"%5D').item(0).value%5D %3D elem.querySelectorAll('input%5Bplaceholder%3D"Value"%5D').item(0).value %7D)%3B const win %3D window.open(''%2C '_blank')%3B win.document.write(%60Debugger URL%3A chrome-devtools%3A%2F%2Fdevtools%2Fremote%2Fserve_file%2F%4060cd6e859b9f557d2312f5bf532f6aec5f284980%2Finspector.html%3Fexperiments%3Dtrue%26v8only%3Dtrue%26ws%3D%24%7Bobj.DEBUGGER_BROKER_ADDRESS%7D%3A9229%2F%24%7Bobj.DEBUGGER_FUNCTION_ID%7D%60)%7D)()
12+
*/

0 commit comments

Comments
 (0)