zuplo 6.72.14 → 6.72.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,18 +3,41 @@ title: "Debugging Locally"
|
|
|
3
3
|
sidebar_label: Debugging
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
etc., will be available to help you debug your gateway.
|
|
6
|
+
Set breakpoints, step through code, and inspect variables in your route handlers
|
|
7
|
+
and custom policies while your gateway runs locally.
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
already have an older/existing `.vscode/launch.json` file, you can add the
|
|
12
|
-
section in the curly braces to the configurations array. Take note of the
|
|
13
|
-
port value since that's the value you will specify next.
|
|
9
|
+
## VS Code
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
New projects created with `create-zuplo-api` ship with a `.vscode/launch.json`
|
|
12
|
+
that's ready to go.
|
|
13
|
+
|
|
14
|
+
<Stepper>
|
|
15
|
+
|
|
16
|
+
1. Open **Run and Debug** (View > Run and Debug).
|
|
17
|
+
|
|
18
|
+
1. Select **Launch & Attach Zuplo** and click the green play button.
|
|
19
|
+
|
|
20
|
+
1. Set a breakpoint, then send a request to the route. See
|
|
21
|
+
[Breakpoints not binding?](#breakpoints-not-binding) if it doesn't stop.
|
|
22
|
+
|
|
23
|
+
</Stepper>
|
|
24
|
+
|
|
25
|
+
If your project doesn't have a `.vscode/launch.json`, create one with these
|
|
26
|
+
contents and repeat the steps above:
|
|
27
|
+
|
|
28
|
+
```json title=".vscode/launch.json"
|
|
16
29
|
{
|
|
30
|
+
"version": "0.2.0",
|
|
17
31
|
"configurations": [
|
|
32
|
+
{
|
|
33
|
+
"type": "node",
|
|
34
|
+
"request": "launch",
|
|
35
|
+
"name": "Launch Zuplo",
|
|
36
|
+
"runtimeExecutable": "npx",
|
|
37
|
+
"runtimeArgs": ["zuplo", "dev", "--debug-port", "9229", "--port", "9000"],
|
|
38
|
+
"console": "integratedTerminal",
|
|
39
|
+
"internalConsoleOptions": "neverOpen"
|
|
40
|
+
},
|
|
18
41
|
{
|
|
19
42
|
"name": "Zuplo Gateway",
|
|
20
43
|
"type": "node",
|
|
@@ -22,23 +45,54 @@ etc., will be available to help you debug your gateway.
|
|
|
22
45
|
"restart": true,
|
|
23
46
|
"port": 9229
|
|
24
47
|
}
|
|
48
|
+
],
|
|
49
|
+
"compounds": [
|
|
50
|
+
{
|
|
51
|
+
"name": "Launch & Attach Zuplo",
|
|
52
|
+
"configurations": ["Launch Zuplo", "Zuplo Gateway"]
|
|
53
|
+
}
|
|
25
54
|
]
|
|
26
55
|
}
|
|
27
56
|
```
|
|
28
57
|
|
|
29
|
-
|
|
58
|
+
## WebStorm, IntelliJ, and other editors
|
|
30
59
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
60
|
+
<Stepper>
|
|
61
|
+
|
|
62
|
+
1. Start the gateway with the debug port open:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npx zuplo dev --debug-port 9229
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
1. Add an **Attach to Node.js/Chrome** run configuration pointed at
|
|
69
|
+
`localhost:9229` and run it in debug mode. In JetBrains IDEs, enable
|
|
70
|
+
**Reconnect automatically** so it re-attaches after each reload.
|
|
71
|
+
|
|
72
|
+
1. Set a breakpoint, then send a request to the route. See
|
|
73
|
+
[Breakpoints not binding?](#breakpoints-not-binding) if it doesn't stop.
|
|
74
|
+
|
|
75
|
+
</Stepper>
|
|
76
|
+
|
|
77
|
+
:::caution
|
|
78
|
+
|
|
79
|
+
Don't use "Debug the `npm run dev` script." Your policies run in a separate
|
|
80
|
+
runtime process, so debugging the npm script attaches to the wrong process and
|
|
81
|
+
breakpoints never bind. Always start with `--debug-port` and attach to it, as
|
|
82
|
+
above.
|
|
83
|
+
|
|
84
|
+
:::
|
|
85
|
+
|
|
86
|
+
## Breakpoints not binding?
|
|
34
87
|
|
|
35
|
-
|
|
36
|
-
|
|
88
|
+
A breakpoint may show as **unbound** (a hollow marker) until the route runs for
|
|
89
|
+
the first time — each policy is loaded on first use, so the debugger has nothing
|
|
90
|
+
to attach to until then. To fix it:
|
|
37
91
|
|
|
38
|
-
|
|
92
|
+
1. Send a request to the route once. The breakpoint marker turns solid.
|
|
93
|
+
1. Send the request again — execution now stops at your breakpoint.
|
|
39
94
|
|
|
40
95
|
## Limitations
|
|
41
96
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
through them.
|
|
97
|
+
You can only step through your own code. System code provided by Zuplo is
|
|
98
|
+
minified and stripped of source maps, so you can't step into it.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zuplo",
|
|
3
|
-
"version": "6.72.
|
|
3
|
+
"version": "6.72.16",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The programmable API Gateway",
|
|
6
6
|
"author": "Zuplo, Inc.",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"zuplo": "zuplo.js"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@zuplo/cli": "6.72.
|
|
23
|
-
"@zuplo/core": "6.72.
|
|
24
|
-
"@zuplo/runtime": "6.72.
|
|
22
|
+
"@zuplo/cli": "6.72.16",
|
|
23
|
+
"@zuplo/core": "6.72.16",
|
|
24
|
+
"@zuplo/runtime": "6.72.16",
|
|
25
25
|
"@zuplo/test": "1.4.0"
|
|
26
26
|
}
|
|
27
27
|
}
|