-
Notifications
You must be signed in to change notification settings - Fork 432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WikiUpdaterTask@2 ##[error]TypeError: contents.replace is not a function #1569
Comments
* Add a Codespaces defintion with sensible extensions * Add more logging on content loading a null check on the content string #1569
That error points to the fact that the contents object is null, either no content was passed as a string, or the content loaded from the source file is null. But the tests you have done would point to this not being the case. I have added extra logging and a null check on the contents variable in 2.9.x, can you retest with that. |
Hello, I do have the extra log |
May have changed in newer version of nodejs, but the documentation of latest version says "If the encoding option is specified then this function returns a string. Otherwise it returns a buffer." |
All my Node based tasks support Node10 and Node 16 and have done so since December 2022. So unless you are using a private agent I don't think the Node version is the issue. As you are using the if (dataIsFile === true) {
if (fs.existsSync(sourceFile)) {
logInfo(`Reading file ${sourceFile}`);
if (fixLineFeeds) {
contents = fs.readFileSync(sourceFile, "utf8");
} else {
contents = fs.readFileSync(sourceFile);
}
} else {
// we do this late copy so that we can use the same property for different encodings with a type clash
logInfo(`Using contents string directly input`);
contents = contentsInput;
} The error message you report can only appear if you have the |
I'm using public Azure DevOps agents with ubuntu-latest image. I set I disable all parameters that can modify the file down to
Then, I set I cannot find a path where the contents is left untouched and simply passed to a write function that would, I guess, accept the buffer object as is. |
Thanks @scrocquesel-ml150 for isolating the problem so well. I think after testing the simplest option is to just |
* Add a Codespaces defintion with sensible extensions * Add more logging on content loading a null check on the content string rfennell#1569
Azure DevOps Extensions
WIKI Updater
Platform
Azure DevOps Services
Azure DevOps Server (TFS) Version
No response
Extension Version
2.8.3
Describe the bug
I have a pipeline that chain XplatGenerateRelease and WikiUpdater on a ubuntu-latest agent
The first task did produce a content in the outputfile (i can echo its content in a script task in between.)
It happens with or without the target file exists in the wiki repo.
Repo Steps
The yaml pipeline is
Expected Behavior
No error or a proper error message to help fix the sourcefile or the changelog file.
Logging Information
The text was updated successfully, but these errors were encountered: