admin管理员组文章数量:1414935
Hopefully I am just being thick. I am new to devops extensions, I have stripped back my code to the bare minimum to try and solve this issue but with no luck. Copilot has been pretty useless as well. I have installed my extension on my devops environment and when loading it up, I get the consol error even though my html loads up fine:
No handler found on any channel for message: {"id":1,"methodName":"","instanceId":"JColvile.ally.ally","instanceContext":{"user":{"id":"199e5f78-06e1-648d-b8bd-71ec64702aa0","name":"Joseph colvile","subjectType":"msa","subjectId":"199e5f78-06e1-748d-b8bd-71ec64702aa0","email":"[email protected]","uniqueName":"[email protected]"},"project":{"id":"45af2015-9cd4-449e-9708-d7dc6ce25661","name":"Test"},"collection":{"id":"0dee7a15-1ab5-4d3f-8099-621326a484c5","name":"josephcolvile","uri":"/","relativeUri":"/josephcolvile/"},"account":{"id":"4aab89c0-5375-4d4f-b539-b47aeb1d04f1","name":"josephcolvile","uri":"/","relativeUri":"/josephcolvile/"},"host":{"id":"0dee7a15-1ab5-4d3f-8099-621326a484c5","name":"josephcolvile","uri":"/","relativeUri":"/josephcolvile/","hostType":4,"scheme":"https","authority":"dev.azure"}},"params":null,"jsonrpc":"2.0"}
This is my HTML file:
<!DOCTYPE html>
<html xmlns=";>
<head>
<script src=".js/2.3.6/require.min.js"></script>
<script>
window.requirejs.config({
enforceDefine: true,
paths: {
'SDK': './lib/SDK.min'
}
});
window.requirejs(['SDK'], function (SDK) {
if (typeof SDK !== 'undefined') {
console.log("SDK is defined. Trying to initialize...");
SDK.init();
SDK.ready().then(() => {
console.log("SDK is ready");
document.getElementById("name").innerText = SDK.getUser().displayName;
});
} else {
console.log('SDK is not defined');
}
});
</script>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>AI Assist - User Story Generation</h1>
<form id="userStoryForm" onsubmit="return false;">
<label for="Description">Requirement Description:</label><br>
<input type="text" id="Description" name="Description"><br>
<input type="submit" value="Generate User Story">
</form>
<div id="result"></div>
<footer>
<p>Logged in as: <span id="name"></span></p>
</footer>
</body>
</html>
And this is my vss-extension.json contents:
{
"manifestVersion": 1,
"id": "ally",
"publisher": "JColvile",
"version": "1.0.10",
"name": "ally",
"description": "A sample Visual Studio Services extension",
"public": false,
"categories": ["Azure Repos"],
"targets": [
{
"id": "Microsoft.VisualStudio.Services"
}
],
"contributions": [
{
"id": "ally",
"type": "ms.vss-work-web.work-item-form-page",
"targets": [
"ms.vss-work-web.work-item-form"
],
"properties": {
"name": "My Hub",
"uri": "ally.html"
}
}
],
"files": [
{
"path": "ally.html",
"addressable": true
},
{
"path": "style.css",
"addressable": true
},
{
"path": "node_modules/azure-devops-extension-sdk",
"addressable": true,
"packagePath": "lib"
}
]
}
Any ideas on how I resolve this? Or could this be one of those errors that I can just ignore ;)
Installed npm install azure-devops-extension-sdk --save
This populated my node_modules files. I then created my vss-extension.json file and populated it with the MS default from =%2Fazure%2Fdevops%2Fmarketplace-extensibility%2Ftoc.json&view=azure-devops.
I then created my basic HTML page, ensuring that the html file is referenced in the vss-extension.
I then ran the npx tfx-cli extension create command to package and create my vsix file. I then published this to the devops extension store and installed on my devops anization. I am working through step by step as this is my first extension and am unsure why this consol error is occurring.
Hopefully I am just being thick. I am new to devops extensions, I have stripped back my code to the bare minimum to try and solve this issue but with no luck. Copilot has been pretty useless as well. I have installed my extension on my devops environment and when loading it up, I get the consol error even though my html loads up fine:
No handler found on any channel for message: {"id":1,"methodName":"","instanceId":"JColvile.ally.ally","instanceContext":{"user":{"id":"199e5f78-06e1-648d-b8bd-71ec64702aa0","name":"Joseph colvile","subjectType":"msa","subjectId":"199e5f78-06e1-748d-b8bd-71ec64702aa0","email":"[email protected]","uniqueName":"[email protected]"},"project":{"id":"45af2015-9cd4-449e-9708-d7dc6ce25661","name":"Test"},"collection":{"id":"0dee7a15-1ab5-4d3f-8099-621326a484c5","name":"josephcolvile","uri":"https://dev.azure/josephcolvile/","relativeUri":"/josephcolvile/"},"account":{"id":"4aab89c0-5375-4d4f-b539-b47aeb1d04f1","name":"josephcolvile","uri":"https://dev.azure/josephcolvile/","relativeUri":"/josephcolvile/"},"host":{"id":"0dee7a15-1ab5-4d3f-8099-621326a484c5","name":"josephcolvile","uri":"https://dev.azure/josephcolvile/","relativeUri":"/josephcolvile/","hostType":4,"scheme":"https","authority":"dev.azure"}},"params":null,"jsonrpc":"2.0"}
This is my HTML file:
<!DOCTYPE html>
<html xmlns="http://www.w3./1999/xhtml">
<head>
<script src="https://cdnjs.cloudflare/ajax/libs/require.js/2.3.6/require.min.js"></script>
<script>
window.requirejs.config({
enforceDefine: true,
paths: {
'SDK': './lib/SDK.min'
}
});
window.requirejs(['SDK'], function (SDK) {
if (typeof SDK !== 'undefined') {
console.log("SDK is defined. Trying to initialize...");
SDK.init();
SDK.ready().then(() => {
console.log("SDK is ready");
document.getElementById("name").innerText = SDK.getUser().displayName;
});
} else {
console.log('SDK is not defined');
}
});
</script>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>AI Assist - User Story Generation</h1>
<form id="userStoryForm" onsubmit="return false;">
<label for="Description">Requirement Description:</label><br>
<input type="text" id="Description" name="Description"><br>
<input type="submit" value="Generate User Story">
</form>
<div id="result"></div>
<footer>
<p>Logged in as: <span id="name"></span></p>
</footer>
</body>
</html>
And this is my vss-extension.json contents:
{
"manifestVersion": 1,
"id": "ally",
"publisher": "JColvile",
"version": "1.0.10",
"name": "ally",
"description": "A sample Visual Studio Services extension",
"public": false,
"categories": ["Azure Repos"],
"targets": [
{
"id": "Microsoft.VisualStudio.Services"
}
],
"contributions": [
{
"id": "ally",
"type": "ms.vss-work-web.work-item-form-page",
"targets": [
"ms.vss-work-web.work-item-form"
],
"properties": {
"name": "My Hub",
"uri": "ally.html"
}
}
],
"files": [
{
"path": "ally.html",
"addressable": true
},
{
"path": "style.css",
"addressable": true
},
{
"path": "node_modules/azure-devops-extension-sdk",
"addressable": true,
"packagePath": "lib"
}
]
}
Any ideas on how I resolve this? Or could this be one of those errors that I can just ignore ;)
Installed npm install azure-devops-extension-sdk --save
This populated my node_modules files. I then created my vss-extension.json file and populated it with the MS default from https://learn.microsoft/en-us/azure/devops/extend/get-started/node?toc=%2Fazure%2Fdevops%2Fmarketplace-extensibility%2Ftoc.json&view=azure-devops.
I then created my basic HTML page, ensuring that the html file is referenced in the vss-extension.
I then ran the npx tfx-cli extension create command to package and create my vsix file. I then published this to the devops extension store and installed on my devops anization. I am working through step by step as this is my first extension and am unsure why this consol error is occurring.
Share Improve this question asked Feb 21 at 5:57 Joe ColvileJoe Colvile 11 Answer
Reset to default 0The error message "No handler found on any channel for message" typically indicates that your extension is trying to send or receive a message, but there is no handler registered to process it. Checking your HTML, I don't find any handler registered like:
VSS.register(VSS.getContribution().id, function () {
return {
// Called when the active work item is modified
onFieldChanged: function(args) {
$(".events").append($("<div/>").text("onFieldChanged - " + JSON.stringify(args)));
},
// Called when a new work item is being loaded in the UI
onLoaded: function (args) {
getWorkItemFormService().then(function(service) {
// Get the current values for a few of the common fields
service.getFieldValues(["System.Id", "System.Title", "System.State", "System.CreatedDate"]).then(
function (value) {
$(".events").append($("<div/>").text("onLoaded - " + JSON.stringify(value)));
},
function(error) {
window.alert(error.message);
});
});
},
// Called when the active work item is being unloaded in the UI
onUnloaded: function (args) {
$(".events").empty();
$(".events").append($("<div/>").text("onUnloaded - " + JSON.stringify(args)));
},
// Called after the work item has been saved
onSaved: function (args) {
$(".events").append($("<div/>").text("onSaved - " + JSON.stringify(args)));
},
// Called when the work item is reset to its unmodified state (undo)
onReset: function (args) {
$(".events").append($("<div/>").text("onReset - " + JSON.stringify(args)));
},
// Called when the work item has been refreshed from the server
onRefreshed: function (args) {
$(".events").append($("<div/>").text("onRefreshed - " + JSON.stringify(args)));
}
}
});
You can refer to this example to understand how to use message handlers.
本文标签: htmlDevops extension consol errorNo handler found on any channel for messageStack Overflow
版权声明:本文标题:html - Devops extension consol error - No handler found on any channel for message - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745165695a2645663.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论