Path Argument Error When Adding Flutter Support to VS Code Docker Extension
I've been working on adding support for Flutter projects in the ms-azuretools.vscode-docker extension. This involves generating Dockerfiles for Flutter projects. However, I've encountered an error related to the path argument being undefined. The specific error message is: "Error: The 'path' argument must be of type string. Received undefined."
I am trying to add the path when generating the Dockerfile into the project for Flutter, but it's not working and throws the error mentioned above.
Here is the function where I add the path when generating the Dockerfile. If you need the code, please let me know.
` private async getInputPath(wizardContext: TWizardContext): Promise
console.log('Workspace Folder:', wizardContext.workspaceFolder);
console.log('Dockerfile Directory:', wizardContext.dockerfileDirectory);
///TODO: for flutter [dockerfileDirectory] is undefined need to check that
let subPath: string;
switch (wizardContext.platform) {
case 'Node.js':
subPath = path.join('node', `${this.fileType}.template`);
break;
case 'Flutter':
subPath = path.join('flutter', `${this.fileType}.template`);
break;
case 'Python: General':
subPath = path.join('python', `${this.fileType}.template`);
break;
// Additional cases...
default:
throw new Error(`Unknown platform '${wizardContext.platform}'`);
}
// Validate paths before usage
console.log('Settings Templates Path:', settingsTemplatesPath);
console.log('Default Templates Path:', defaultTemplatesPath);
console.log('SubPath:', subPath);
if (!settingsTemplatesPath && !defaultTemplatesPath) {
throw new Error('Both settingsTemplatesPath and defaultTemplatesPath are undefined.');
}
// Use valid paths
return (settingsTemplatesPath && await this.scanUpwardForFile(path.join(settingsTemplatesPath, subPath))) ||
await this.scanUpwardForFile(path.join(defaultTemplatesPath, subPath));
}
`
but if I select any other option it generates Dockerfile normally.
Kindly assist on this @bwateratmsft , @chrisdias , @StephenWeatherford , @ravipal
@hussnain-2015371 , can you share the error message or call stack of where you hit this. Or please share out a branch or repo for your code. In a simple test I was able to make this work
@hussnain-2015371 , can you share the error message or call stack of where you hit this. Or please share out a branch or repo for your code. In a simple test I was able to make this work
here's branch: https://github.com/hs-dev1/vscode-docker/tree/vscode-docker-flutter
@hussnain-2015371, after line 18 in https://github.com/hs-dev1/vscode-docker/blob/vscode-docker-flutter/src/scaffolding/wizard/flutter/FlutterGatherInformationStep.ts you need to call
await super.prompt(wizardContext);
the base GatherInformationStep sets the wizardContext.dockerfileDirectory
This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.
Happy Coding!