Unable to correctly configure TeamSettingsProcessor - azure-devops-migration-tools

I am trying to figure out how to use the TeamSettingsProcessor to migrate teams between two Azure DevOps Server Projects. At first, I tried the configuration stated in the GitHub docs page:
{
"$type": "TeamMigrationConfig",
"Enabled": true,
"EnableTeamSettingsMigration": true,
"FixTeamSettingsForExistingTeams": true,
"PrefixProjectToNodes": false
}
That one simply returned:
[09:14:22 FTL] *************MIGRATION ALERT!!!!!!!!!
[09:14:22 FTL] TeamMigrationContext has been migrated to TfsTeamSettingsProcessor: https://nkdagility.github.io/azure-devops-migration-tools/Reference/Processors/TfsTeamSettingsProcessor.html"
So I switched to use the one referred to in the message (which apparently is in preview):
{
"$type": "TfsTeamSettingsProcessorOptions",
"Enabled": true,
"MigrateTeamSettings": true,
"UpdateTeamSettings": true,
"PrefixProjectToNodes": false,
"Teams": null,
"ProcessorEnrichers": null,
"Source": {
"$type": "TfsTeamSettingsEndpointOptions",
"Organisation": "https://company.com/tfs/Collection/",
"Project": "SourceProject",
"AuthenticationMode": "Prompt",
"ReflectedWorkItemIdField": "Custom.Field",
"LanguageMaps": {
"$type": "TfsLanguageMapOptions",
"AreaPath": "Area",
"IterationPath": "Iteration"
},
"EndpointEnrichers": null
},
"Target": {
"$type": "TfsTeamSettingsEndpointOptions",
"Organisation": "https://company.com/tfs/Collection/",
"Project": "TargetProject",
"AuthenticationMode": "Prompt",
"ReflectedWorkItemIdField": "Custom.Field",
"LanguageMaps": {
"$type": "TfsLanguageMapOptions",
"AreaPath": "Area",
"IterationPath": "Iteration"
},
"EndpointEnrichers": null
}
}
But that simply returns the error
[09:38:40 INF] Start Time: 02/09/2021 09:38:40
[09:38:40 INF] Running with args: execute
[09:38:40 INF] OSVersion: Microsoft Windows NT 6.2.9200.0
[09:38:40 INF] Version: 11.9.31.0
[09:38:48 INF] Latest version detected as 11.9.31.0
[09:38:48 DBG] Hosting starting
[09:38:48 INF] Application started. Press Ctrl+C to shut down.
[09:38:48 INF] Hosting environment: Production
[09:38:48 INF] Content root path: C:\git\DevIT\WorkItemMigration
[09:38:48 INF] Press Ctrl+C to shut down.
[09:38:48 DBG] Hosting started
[09:38:48 INF] Config Found, creating engine host
[09:38:49 INF] Creating Migration Engine 1fa254e5-abbf-4342-b1f0-1a72863f0b49
[09:38:49 INF] ProcessorContainer: Of 3 configured Processors only 1 are enabled
[09:38:49 INF] ProcessorContainer: Adding Processor TfsTeamSettingsProcessor
[09:38:49 INF] Processor::Configure
[09:38:49 ERR] Unhandled exception!
System.ArgumentNullException: Value cannot be null.
Parameter name: name
at MigrationTools.Endpoints.EndpointFactory.CreateEndpoint(String name) in D:\a\1\s\src\MigrationTools\Endpoints\EndpointFactory.cs:line 43
at MigrationTools.Processors.Processor.Configure(IProcessorOptions options) in D:\a\1\s\src\MigrationTools\Processors\Processor.cs:line 50
at MigrationTools.Processors.TfsTeamSettingsProcessor.Configure(IProcessorOptions options) in D:\a\1\s\src\MigrationTools.Clients.AzureDevops.ObjectModel\Processors\TfsTeamSettingsProcessor.cs:line 35
at MigrationTools._EngineV1.Containers.ProcessorContainer.Configure() in D:\a\1\s\src\MigrationTools\_EngineV1\Containers\ProcessorContainer.cs:line 61
at MigrationTools.MigrationEngine.Run() in D:\a\1\s\src\MigrationTools\MigrationEngine.cs:line 87
at MigrationTools.Host.ExecuteHostedService.<StartAsync>b__5_1() in D:\a\1\s\src\MigrationTools.Host\ExecuteHostedService.cs:line 38
I fail to see what parameter name that is missing?

I use their migrator quite often and I took a look into your issue.
I was able to replicate your issue exactly. When I dug into the exception, it looks like they changed their implementation of the TfsTeamSettingsProcessorOptions to not use the Source and Target nodes, despite this configuration being in their documentation.
What you'll need to do is update your TfsTeamSettingsProcessorOptions to point to named TfsEndpoints configured within the Endpoints array using SourceName and TargetName attributes.
It would look something like this in your case:
{
"$type": "TfsTeamSettingsProcessorOptions",
"Enabled": true,
"MigrateTeamSettings": true,
"UpdateTeamSettings": true,
"PrefixProjectToNodes": false,
"Teams": null,
"ProcessorEnrichers": null,
"SourceName": "Source",
"TargetName": "Target"
}

Related

Unable to successfully migrate a project: TF201077: The work item type cannot be found

I've successfully migrated both stock and bespoke projects but I'm having trouble with one project I can't move based on the same config file (so it's probably not the config).
It looks like it's unable to save the work item. I've tried project to project in the same org using the same process, org to org, and removing any iterations. I just get the same error.
The work items I'm migrating are extremely basic tasks/stories with no bespoke fields populated.
I'm getting the following:
[11:33:24 ERR] Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemTypeDeniedOrNotExistException: TF201077: The work item type cannot be found. It may have been renamed or destroyed.
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem.get_Type()
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemFieldData.Microsoft.TeamFoundation.WorkItemTracking.Internals.IWorkItemOpenFieldDataHelper.SetLatestData(Dictionary`2 latestData)
at Microsoft.TeamFoundation.WorkItemTracking.Internals.WorkItemHelper.LoadWorkItemFieldData(IRowSetCollectionHelper tables, IWorkItemOpenFieldDataHelper helper)
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem.LoadWorkItemFromRowSetInternal(Int32 rev, Nullable`1 asof, IWorkItemRowSets witem)
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem..ctor(WorkItemStore store, Int32 id, Int32 revision)
at MigrationTools.TfsExtensions.GetRevision(WorkItemData context, Int32 rev) in D:\a\1\s\src\MigrationTools.Clients.AzureDevops.ObjectModel\TfsExtensions.cs:line 35
at VstsSyncMigrator.Engine.WorkItemMigrationContext.ReplayRevisions(List`1 revisionsToMigrate, WorkItemData sourceWorkItem, WorkItemData targetWorkItem) in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\WorkItemMigrationContext.cs:line 600
and at the end:
[11:33:25 ERR] Microsoft.TeamFoundation.WorkItemTracking.Client.ValidationException: TF237124: Work Item is not ready to save
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem.Save(SaveFlags saveFlags)
at MigrationTools.TfsExtensions.SaveToAzureDevOps(WorkItemData context) in D:\a\1\s\src\MigrationTools.Clients.AzureDevops.ObjectModel\TfsExtensions.cs:line 76
at VstsSyncMigrator.Engine.WorkItemMigrationContext.ReplayRevisions(List`1 revisionsToMigrate, WorkItemData sourceWorkItem, WorkItemData targetWorkItem) in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\WorkItemMigrationContext.cs:line 643
[11:33:25 INF] ===============================================================
[11:33:25 WRN] Work Item is not ready to save as it has some invalid fields. This may not result in an error. Enable LogLevel as 'Debug' in the config to see more.
[11:33:25 ERR] Microsoft.TeamFoundation.WorkItemTracking.Client.ValidationException: TF237124: Work Item is not ready to save
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem.Save(SaveFlags saveFlags)
at MigrationTools.TfsExtensions.SaveToAzureDevOps(WorkItemData context) in D:\a\1\s\src\MigrationTools.Clients.AzureDevops.ObjectModel\TfsExtensions.cs:line 76
at VstsSyncMigrator.Engine.WorkItemMigrationContext.<ProcessWorkItemAsync>d__35.MoveNext() in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\WorkItemMigrationContext.cs:line 486
Microsoft.TeamFoundation.WorkItemTracking.Client.ValidationException: TF237124: Work Item is not ready to save
at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem.Save(SaveFlags saveFlags)
at MigrationTools.TfsExtensions.SaveToAzureDevOps(WorkItemData context) in D:\a\1\s\src\MigrationTools.Clients.AzureDevops.ObjectModel\TfsExtensions.cs:line 76
at VstsSyncMigrator.Engine.WorkItemMigrationContext.<ProcessWorkItemAsync>d__35.MoveNext() in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\WorkItemMigrationContext.cs:line 486
[11:33:25 ERR] Could not save migrated work item 35, an exception occurred.
System.AggregateException: One or more errors occurred. ---> Microsoft.TeamFoundation.WorkItemTracking.Client.ValidationException: TF237124: Work Item is not ready to save
at VstsSyncMigrator.Engine.WorkItemMigrationContext.<ProcessWorkItemAsync>d__35.MoveNext() in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\WorkItemMigrationContext.cs:line 531
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at VstsSyncMigrator.Engine.WorkItemMigrationContext.InternalExecute() in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\WorkItemMigrationContext.cs:line 205
---> (Inner Exception #0) Microsoft.TeamFoundation.WorkItemTracking.Client.ValidationException: TF237124: Work Item is not ready to save
at VstsSyncMigrator.Engine.WorkItemMigrationContext.<ProcessWorkItemAsync>d__35.MoveNext() in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\WorkItemMigrationContext.cs:line 531<---
[11:33:25 WRN] The following items could not be migrated: 35
[11:33:25 INF] DONE in 00:00:05.6093139
[11:33:25 FTL] Error while running WorkItemMigration
System.AggregateException: One or more errors occurred. ---> Microsoft.TeamFoundation.WorkItemTracking.Client.ValidationException: TF237124: Work Item is not ready to save
at VstsSyncMigrator.Engine.WorkItemMigrationContext.<ProcessWorkItemAsync>d__35.MoveNext() in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\WorkItemMigrationContext.cs:line 531
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at VstsSyncMigrator.Engine.WorkItemMigrationContext.InternalExecute() in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\WorkItemMigrationContext.cs:line 225
at MigrationTools._EngineV1.Processors.MigrationProcessorBase.Execute() in D:\a\1\s\src\MigrationTools\_EngineV1\Processors\MigrationProcessorBase.cs:line 47
---> (Inner Exception #0) Microsoft.TeamFoundation.WorkItemTracking.Client.ValidationException: TF237124: Work Item is not ready to save
at VstsSyncMigrator.Engine.WorkItemMigrationContext.<ProcessWorkItemAsync>d__35.MoveNext() in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\WorkItemMigrationContext.cs:line 531<---
[11:33:25 ERR] WorkItemMigration The Processor MigrationEngine entered the failed state...stopping run
[11:33:25 INF] Application is shutting down...
[11:33:25 INF] Terminating: Application forcebly closed.
[11:33:25 INF] Application Ending
[11:33:25 INF] The application ran in 00:00:10.7989077 and finished at 07/27/2022 11:33:25
The config is:
{
"ChangeSetMappingFile": null,
"Source": {
"$type": "TfsTeamProjectConfig",
"Collection": "https://dev.azure.com/XXXX/",
"Project": "XXXX",
"ReflectedWorkItemIDFieldName": "Custom.ReflectedWorkItemId",
"AllowCrossProjectLinking": false,
"AuthenticationMode": "AccessToken",
"PersonalAccessToken": "XXXXX",
"PersonalAccessTokenVariableName": "",
"LanguageMaps": {
"AreaPath": "Area",
"IterationPath": "Iteration"
}
},
"Target": {
"$type": "TfsTeamProjectConfig",
"Collection": "https://dev.azure.com/XXXX/",
"Project": "XXXX",
"ReflectedWorkItemIDFieldName": "Custom.ReflectedWorkItemId",
"AllowCrossProjectLinking": false,
"AuthenticationMode": "AccessToken",
"PersonalAccessToken": "XXXX",
"PersonalAccessTokenVariableName": "",
"LanguageMaps": {
"AreaPath": "Area",
"IterationPath": "Iteration"
}
},
"FieldMaps": [
],
"GitRepoMapping": null,
"LogLevel": "Information",
"CommonEnrichersConfig": null,
"Processors": [
{
"$type": "WorkItemMigrationConfig",
"Enabled": true,
"ReplayRevisions": true,
"PrefixProjectToNodes": false,
"UpdateCreatedDate": true,
"UpdateCreatedBy": true,
"WIQLQueryBit": "AND [Microsoft.VSTS.Common.ClosedDate] = '' AND [System.WorkItemType] NOT IN ('Test Suite', 'Test Plan','Shared Steps','Shared Parameter','Feedback Request')",
"WIQLOrderBit": "[System.ChangedDate] desc",
"LinkMigration": true,
"AttachmentMigration": true,
"AttachmentWorkingPath": "c:\\temp\\WorkItemAttachmentWorkingFolder\\",
"FixHtmlAttachmentLinks": false,
"SkipToFinalRevisedWorkItemType": true,
"WorkItemCreateRetryLimit": 5,
"FilterWorkItemsThatAlreadyExistInTarget": true,
"PauseAfterEachWorkItem": false,
"AttachmentMaxSize": 480000000,
"AttachRevisionHistory": false,
"LinkMigrationSaveEachAsAdded": false,
"GenerateMigrationComment": true,
"WorkItemIDs": null,
"MaxRevisions": 0,
"NodeStructureEnricherEnabled": null,
"UseCommonNodeStructureEnricherConfig": false,
"NodeBasePaths": [
"Product\\Area\\Path1",
"Product\\Area\\Path2"
],
"AreaMaps": {},
"IterationMaps": {},
"MaxGracefulFailures": 0
}
],
"Version": "12.0",
"workaroundForQuerySOAPBugEnabled": false,
"WorkItemTypeDefinition": {
"sourceWorkItemTypeName": "targetWorkItemTypeName"
},
"Endpoints": {
"InMemoryWorkItemEndpoints": [
{
"Name": "Source",
"EndpointEnrichers": null
},
{
"Name": "Target",
"EndpointEnrichers": null
}
]
}
}
Posting an answer in case anyone else had the same problem.
My issue was in the config file after all. It had example data under the node base paths:
"NodeBasePaths": [
"Product\\Area\\Path1",
"Product\\Area\\Path2"
],
and that prevented the node mapping which caused the save to fail and produced the error. Simply removing all data in that section if I'm not using it solved the problem.

Web Activity endless running In Azure Data Factory

Currently it seems that web activity is broken.
When using simple pipeline
{
"name": "pipeline1",
"properties": {
"activities": [
{
"name": "Webactivity",
"type": "WebActivity",
"dependsOn": [],
"policy": {
"timeout": "7.00:00:00",
"retry": 0,
"retryIntervalInSeconds": 30,
"secureOutput": false,
"secureInput": false
},
"userProperties": [],
"typeProperties": {
"url": "https://www.microsoft.com/",
"connectVia": {
"referenceName": "AutoResolveIntegrationRuntime",
"type": "IntegrationRuntimeReference"
},
"method": "GET",
"body": ""
}
}
],
"annotations": []
}
}
When debugging it never finishes. There is "in progress" for several minutes.
I tried Web hook and it works.
Is there something else I could try?
A quick note on the "never finishes" issue: one of my pet peeves with Data Factory is that the default timeout for all activities is 7 DAYS. While I've had a few activities that needed to run for 7 hours, a WEEK is a ridiculous default timeout value. One of the first things I do in any production scenario is address the timeout values of all the activities.
As to the Web activity question: I set up a quick example in my test bed and it returned just fine:
Looking at the generated code, the only real difference I see is the absence of the "connectVia" property that was in your example:
Ok I've found it.
The default AutoResolveIntegrationRuntime only had managed private network which I couldn't change. So I created a new Integration Runtime with public network setting.
This is a litte bit strange as I started today with a brand new Azure Data Factory.
I wonder why I cannot change the default Integration Runtime to disable virtual network:

vscode Fail to Debug Express Webapp

I'm trying to debug express (node) app on my machine, but debug does not start with no indication what so ever.
This happens on code I'm able to debug on another machine as well as "new" apps created in order to test this issue.
I followed the instructions on vscode site (https://code.visualstudio.com/docs/nodejs/nodejs-debugging) with no success.
Runtime works great - just fail to debug.
Behavior consist on all machine's users (admin/non-admin)
Does anyone have a clue?
My environment setup is:
operating System: Windows 10 Pro version 1803
node version: v10.13.0
vscode version: 1.28.2
This is vscode's trace (note the target not opened warning):
OS: win32 x64
Adapter node: v8.9.3 x64
vscode-chrome-debug-core: 6.7.19
11:20:18 AM, 11/7/2018
node-debug2: 1.28.3
From client: initialize({"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"node2","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us"})
To client: {"seq":0,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"exceptionBreakpointFilters":[{"label":"All Exceptions","filter":"all","default":false},{"label":"Uncaught Exceptions","filter":"uncaught","default":false}],"supportsConfigurationDoneRequest":true,"supportsSetVariable":true,"supportsConditionalBreakpoints":true,"supportsCompletionsRequest":true,"supportsHitConditionalBreakpoints":true,"supportsRestartFrame":true,"supportsExceptionInfoRequest":true,"supportsDelayedStackTraceLoading":true,"supportsValueFormattingOptions":true,"supportsEvaluateForHovers":true,"supportsLoadedSourcesRequest":true,"supportsLogPoints":true,"supportsTerminateRequest":false}}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"ClientRequest/initialize","data":{"Versions.DebugAdapterCore":"6.7.19","Versions.DebugAdapter":"1.28.3","successful":"true","timeTakenInMilliseconds":"3.774888","requestType":"request"}}}
From client: attach({"type":"node2","request":"attach","name":"Attach by Process ID","trace":true,"cwd":"c:\\Users\\roi\\dev\\janus\\src\\tools\\magento2-importer","port":9229,"protocol":"inspector","logFilePath":"c:\\Users\\roi\\AppData\\Roaming\\Code\\logs\\20181107T103352\\exthost1\\ms-vscode.node-debug\\debugadapter.txt","__sessionId":"910bc34a-3629-46b7-8c57-e89c06f5bda0"})
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"debugStarted","data":{"Versions.DebugAdapterCore":"6.7.19","Versions.DebugAdapter":"1.28.3","request":"attach","args":["type","request","name","trace","cwd","port","protocol","logFilePath","__sessionId","enableSourceMapCaching","sourceMapPathOverrides","showAsyncStacks","sourceMaps"]}}}
Getting browser and debug protocol version via http://127.0.0.1:9229/json/version
Discovering targets via http://127.0.0.1:9229/json/list
Got browser version: node.js/v10.13.0
Got debug protocol version: 1.1
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"targetDebugProtocolVersion","data":{"Versions.DebugAdapterCore":"6.7.19","Versions.DebugAdapter":"1.28.3"}}}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"targetCount","data":{"Versions.DebugAdapterCore":"6.7.19","Versions.DebugAdapter":"1.28.3","numTargets":1}}}
Attaching to target: {"description":"node.js instance","devtoolsFrontendUrl":"chrome-devtools://devtools/bundled/js_app.html?experiments=true&v8only=true&ws=localhost/a575db9e-d5a5-46a5-a49c-a553228c7493","devtoolsFrontendUrlCompat":"chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=localhost/a575db9e-d5a5-46a5-a49c-a553228c7493","faviconUrl":"https://nodejs.org/static/favicon.ico","id":"a575db9e-d5a5-46a5-a49c-a553228c7493","title":"dist/server.js","type":"node","url":"file://C:_Users_roi_dev_janus_src_tools_magento2-importer_dist_server.js","webSocketDebuggerUrl":"ws://127.0.0.1:9229/a575db9e-d5a5-46a5-a49c-a553228c7493","version":{}}
WebSocket Url: ws://127.0.0.1:9229/a575db9e-d5a5-46a5-a49c-a553228c7493
→ To target: "{\"id\":1,\"method\":\"Console.enable\"}"
→ To target: "{\"id\":2,\"method\":\"Debugger.enable\"}"
→ To target: "{\"id\":3,\"method\":\"Runtime.enable\"}"
→ To target: "{\"id\":4,\"method\":\"Log.enable\"}"
→ To target: "{\"id\":5,\"method\":\"Runtime.runIfWaitingForDebugger\"}"
→ Warning: Target not open! Message: "{\"id\":6,\"method\":\"Runtime.run\"}"
Websocket closed
Terminated: websocket closed
Waiting for any pending steps or log messages.
Current step and log messages complete
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"debugStopped","data":{"Versions.DebugAdapterCore":"6.7.19","Versions.DebugAdapter":"1.28.3","reason":"websocket closed"}}}
To client: {"seq":0,"type":"event","event":"terminated"}
From client: disconnect({"restart":false})
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"FullSessionStatistics/SourceMaps/Overrides","data":{"Versions.DebugAdapterCore":"6.7.19","Versions.DebugAdapter":"1.28.3","aspNetClientAppFallbackCount":0}}}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"report-start-up-timings","data":{"Versions.DebugAdapterCore":"6.7.19","Versions.DebugAdapter":"1.28.3","RequestedContentWasDetected":"false","Steps":"[\"BeforeFirstStep\",\"ClientRequest/initialize\",\"ClientRequest/attach\",\"Attach\",\"Attach.RequestDebuggerTargetsInformation\",\"Attach.ProcessDebuggerTargetsInformation\",\"Attach.AttachToTargetDebuggerWebsocket\",\"Attach.ConfigureDebuggingSession.Internal\",\"Attach.ConfigureDebuggingSession.Target\"]","All":"380.614371","BeforeFirstStep":"[18.487202]","WaitingAfter.ClientRequest/initialize":"[22.151169]","ClientRequest/initialize":"[4.841868]","ClientRequest/attach":"[4.11239]","Attach":"[8.248859]","Attach.RequestDebuggerTargetsInformation":"[12.433092]","Attach.ProcessDebuggerTargetsInformation":"[0.720004]","Attach.AttachToTargetDebuggerWebsocket":"[317.133643]","Attach.ConfigureDebuggingSession.Internal":"[0.81632]","Attach.ConfigureDebuggingSession.Target":"[13.309018]","RequestedContentWasNotDetectedReason":"shutdown"}}}
Terminated: Got disconnect request
To client: {"seq":0,"type":"response","request_seq":3,"command":"disconnect","success":true}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"ClientRequest/disconnect","data":{"Versions.DebugAdapterCore":"6.7.19","Versions.DebugAdapter":"1.28.3","successful":"true","timeTakenInMilliseconds":"2.443434","requestType":"request"}}}
This is snippet of vscode screen after debuger was attached. as you can see debugger was attached, but no debug tool bar is present (and no breaks on breakpoints):
You can try to add launch.json by go to Debug->Add Configuration
And then choose Node.js Attach To Process
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach by Process ID",
"processId": "${command:PickProcess}"
},
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": Your Port,
"address": "localhost",
"restart": false,
"sourceMaps": false,
"outDir": null,
"localRoot": "${workspaceRoot}",
"remoteRoot": null
}
]
}
Then run you server as usual, for example
> nodemon app.js
Set breakpoints
And hit Start Debugging
The debugger should kick in and you should smile :)

My AKS Cluster was brought down, how can I recover?

I have been playing around with load-testing my application on a single agent cluster in AKS. During the testing, the connection to the dashboard stalled and never resumed. My application seems down as well, so I am assuming the cluster is in a bad state.
The API server is restate-f4cbd3d9.hcp.centralus.azmk8s.io
kubectl cluster-info dump shows the following error:
{
"name": "kube-dns-v20-6c8f7f988b-9wpx9.14fbbbd6bf60f0cf",
"namespace": "kube-system",
"selfLink": "/api/v1/namespaces/kube-system/events/kube-dns-v20-6c8f7f988b-9wpx9.14fbbbd6bf60f0cf",
"uid": "47f57d3c-d577-11e7-88d4-0a58ac1f0249",
"resourceVersion": "185572",
"creationTimestamp": "2017-11-30T02:36:34Z",
"InvolvedObject": {
"Kind": "Pod",
"Namespace": "kube-system",
"Name": "kube-dns-v20-6c8f7f988b-9wpx9",
"UID": "9d2b20f2-d3f5-11e7-88d4-0a58ac1f0249",
"APIVersion": "v1",
"ResourceVersion": "299",
"FieldPath": "spec.containers{kubedns}"
},
"Reason": "Unhealthy",
"Message": "Liveness probe failed: Get http://10.244.0.4:8080/healthz-kubedns: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)",
"Source": {
"Component": "kubelet",
"Host": "aks-agentpool-34912234-0"
},
"FirstTimestamp": "2017-11-30T02:23:50Z",
"LastTimestamp": "2017-11-30T02:59:00Z",
"Count": 6,
"Type": "Warning"
}
As well as some Pod Sync errors in Kube-System.
Example of issue:
az aks browse -g REstate.Server -n REstate
Merged "REstate" as current context in C:\Users\User\AppData\Local\Temp\tmp29d0conq
Proxy running on http://127.0.0.1:8001/
Press CTRL+C to close the tunnel...
error: error upgrading connection: error dialing backend: dial tcp 10.240.0.4:10250: getsockopt: connection timed out
You'll probably need to ssh to the node to see if the Kubelet service is running. For future you can set Resource quotas from exhausting all resources in the cluster nodes.
Resource Quotas -https://kubernetes.io/docs/concepts/policy/resource-quotas/

Debug ExpressJS server side code using Visual Studio Code

i have made a simple CRUD app using
express: 4.13.4
gulp: 3.9.1
mongodb :v3.0.6
reactjs : 15.0.2.
node : 4.0.0
For server side code i hear it is possible to debug via Visual Studio Code (v1.1.1.).
From git bash i start the app via gulp serve.But i am at a loss to find out how to Start debugging!
A snippet of my gulp task.
gulp.task('serve',['bundle','start-server'],function(){
browserSync.init({
proxy:'http://localhost:3000',
port:9001
});
});
When we click the debug button on VS Code to launch the debug interface, we r presented with a launch.json , where we have two configuration options.
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}",
"stopOnEntry": false,
"args": [],
"cwd": "${workspaceRoot}",
"preLaunchTask": null,
"runtimeExecutable": null,
"runtimeArgs": [
"--nolazy"
],
"env": {
"NODE_ENV": "development"
},
"externalConsole": false,
"sourceMaps": false,
"outDir": null
},
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 3000,
"address": "localhost",
"restart": false,
"sourceMaps": false,
"outDir": null,
"localRoot": "${workspaceRoot}",
"remoteRoot": null
}
]
}
i am guessing these are launch and attach configs. But how do we actually lauch gulp via debug.
i have seen people launch grunt process by modifying the "program" key as "program": "/usr/local/bin/grunt". But it seems i am not able to do that for gulp
Even when i have launched my app via git bash and try to 'attach' the debugger as mentioned here , vs code just shows an error message saying 'Cancelled' !
TLDR;
how do we kick start gulp (or) grunt (or) start the server when we launch debugging in VS code?
is it possible to launch the app externally via cmd or bash and still be able to debug server side code using the debugger? if so , what changes are needed in launch.json?
Allrighty, numerous bookmarks and links later i have finally succeeded in debugging via launch and attach.
Debug via launch config:
{
"name": "Launch",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/server.js",
"stopOnEntry": true,
"args": [],
"cwd": "${workspaceRoot}",
"preLaunchTask": null,
"runtimeExecutable": null,
"runtimeArgs": [
"--nolazy"
],
"env": {
"NODE_ENV": "development"
},
"externalConsole": false,
"sourceMaps": false,
"outDir": null
}
on pressing the green > button on the VSC debug view with launch option selected in the dropdown, you should see something like this in the VSC console.
node --debug-brk=21735 --nolazy server.js
And a the debugger should pause on the first line of your server.js file.
Debug away with breakpoints ! :)
Debug via attach config:
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 5858,
"address": "localhost",
"restart": false,
"sourceMaps": false,
"outDir": null,
"localRoot": "${workspaceRoot}",
"remoteRoot": null
}
Start your server externally
$node --debug-brk server.js
You prompt should be paused at
Debugger listening on port 5858
Press the green > button on the VSC debug view with attach option selected in the dropdown , the debugger should automatically attach itself and pause at the first line of server.js
Debug Ad nauseam