You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/search/cognitive-search-how-to-debug-skillset.md
+37-2Lines changed: 37 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,12 +8,12 @@ author: HeidiSteen
8
8
ms.author: heidist
9
9
ms.service: cognitive-search
10
10
ms.topic: how-to
11
-
ms.date: 12/31/2021
11
+
ms.date: 04/10/2022
12
12
---
13
13
14
14
# Debug an Azure Cognitive Search skillset in Azure portal
15
15
16
-
Start a debug session to identify and resolve errors, validate changes, and push changes to a published skillset in your Azure Cognitive Search service.
16
+
Start a portal-based debug session to identify and resolve errors, validate changes, and push changes to a published skillset in your Azure Cognitive Search service.
17
17
18
18
A debug session is a cached indexer and skillset execution, scoped to a single document, that you can use to edit and test your changes interactively. If you're unfamiliar with how a debug session works, see [Debug sessions in Azure Cognitive Search](cognitive-search-debug-session.md). To practice a debug workflow with a sample document, see [Tutorial: Debug sessions](cognitive-search-tutorial-debug-sessions.md).
19
19
@@ -129,6 +129,41 @@ If skills produce output but the search index is empty, check the field mappings
129
129
130
130
:::image type="content" source="media/cognitive-search-debug/output-field-mappings.png" alt-text="Screenshot of the Output Field Mappings node and details." border="true":::
131
131
132
+
## Debug a custom skill locally
133
+
134
+
Custom skills can be more challenging to debug because the code runs externally. This section describes how to locally debug your Custom Web API skill, debug session, Visual Studio Code and [ngrok](https://ngrok.com/docs). This technique works with custom skills that execute in [Azure Functions](../azure-functions/functions-overview.md) or any other Web Framework that runs locally (for example, [FastAPI](https://fastapi.tiangolo.com/)).
135
+
136
+
### Run ngrok
137
+
138
+
[**ngrok**](https://ngrok.com/docs) is a cross-platform application that can create a tunneling or forwarding URL, so that internet requests reach your local machine. Use ngrok to forward requests from an enrichment pipeline in your search service to your machine to allow local debugging.
139
+
140
+
1. Install ngrok.
141
+
142
+
1. Open a terminal and go to the folder with the ngrok executable.
143
+
144
+
1. Run ngrok with the following command to create a new tunnel:
145
+
146
+
```console
147
+
ngrok http 7071
148
+
```
149
+
150
+
> [!NOTE]
151
+
> By default, Azure Functions are exposed on 7071. Other tools and configurations might require that you provide a different port.
152
+
153
+
1. When ngrok starts, copy and save the public forwarding URL for the next step. The forwarding URL is randomly generated.
154
+
155
+
:::image type="content" source="media/cognitive-search-debug/ngrok.png" alt-text="Screenshot of ngrok terminal." border="false":::
156
+
157
+
### Configure in Azure portal
158
+
159
+
Within the debug session, modify your Custom Web API Skill URI to call the ngrok forwarding URL. Ensure that you append "/api/FunctionName" when using Azure Function for executing the skillset code.
160
+
161
+
You can edit the skill definition in the portal.
162
+
163
+
### Test
164
+
165
+
At this point, new requests from your debug session should now be sent to your local Azure Function. You can use breakpoints in your Visual Studio code to debug your code or run step by step.
166
+
132
167
## Next steps
133
168
134
169
Now that you understand the layout and capabilities of the Debug Sessions visual editor, try the tutorial for a hands-on experience.
0 commit comments