Skip to content
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

TypeError: extension.updatePythonPath is not a function after CLI version 3.6.2 was made available. #4599

Closed
2 tasks done
bryan-strassner opened this issue Jul 21, 2022 · 9 comments

Comments

@bryan-strassner
Copy link
Member

bryan-strassner commented Jul 21, 2022

Before filling a bug

  • have you checked the faq for known issues.
  • have you checked existing issues

Until the 3.6.2 version of the cli was made available, the following command worked for us to setup/install autorest dependencies in a CI pipeline:

node_modules/autorest/entrypoints/app.js --az --python --use=@autorest/[email protected] --azure-validator --version=3.7.6 --help

Coinciding with the 3.6.2 message showing up:

AutoRest code generation utility [cli version: 3.6.1; node: v18.6.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
info    | AutoRest core version selected from configuration: 3.7.6.
debug   | [0.79 s] Network Enabled: true

There is a new version of AutoRest available (3.6.2).
 > You can install the newer version with with npm install -g autorest@latest

Prior to this version advertisement, the pipelines were able to successfully acquire the modules and produce the help messages. Even without moving to the new 3.6.2 version (still running 3.6.1), we now receive the following exception:

TypeError: extension.updatePythonPath is not a function
fatal   | Process() cancelled due to exception : [Exception] AutoRest extension '@autorest/python' terminated. / Error: [Exception] AutoRest extension '@autorest/python' terminated.
    at /home/bstrassner/.autorest/@[email protected]/node_modules/@autorest/core/dist/src_lib_autorest-corets.js:1549:17
    at CallbackList.invoke (/home/bstrassner/.autorest/@[email protected]/node_modules/@autorest/core/dist/vendors-common_temp_node_modules_pnpm_azure-tools_object-comparison_3_0_253_node_modulesazur-23729e.js:107995:39)
    at Emitter.fire (/home/bstrassner/.autorest/@[email protected]/node_modules/@autorest/core/dist/vendors-common_temp_node_modules_pnpm_azure-tools_object-comparison_3_0_253_node_modulesazur-23729e.js:108059:36)
    at closeHandler (/home/bstrassner/.autorest/@[email protected]/node_modules/@autorest/core/dist/vendors-common_temp_node_modules_pnpm_azure-tools_object-comparison_3_0_253_node_modulesazur-23729e.js:108636:26)
    at CallbackList.invoke (/home/bstrassner/.autorest/@[email protected]/node_modules/@autorest/core/dist/vendors-common_temp_node_modules_pnpm_azure-tools_object-comparison_3_0_253_node_modulesazur-23729e.js:107995:39)
    at Emitter.fire (/home/bstrassner/.autorest/@[email protected]/node_modules/@autorest/core/dist/vendors-common_temp_node_modules_pnpm_azure-tools_object-comparison_3_0_253_node_modulesazur-23729e.js:108059:36)
    at StreamMessageReader.exports.modules.../../../common/temp/nodemodules/.pnpm/[email protected]/node_modules/vscode-jsonrpc/lib/messageReader.js.AbstractMessageReader.fireClose (/home/bstrassner/.autorest/@[email protected]/node_modules/@autorest/core/dist/vendors-common_temp_node_modules_pnpm_azure-tools_object-comparison_3_0_253_node_modulesazur-23729e.js:109430:27)
    at Socket.<anonymous> (/home/bstrassner/.autorest/@[email protected]/node_modules/@autorest/core/dist/vendors-common_temp_node_modules_pnpm_azure-tools_object-comparison_3_0_253_node_modulesazur-23729e.js:109483:62)
    at Socket.emit (node:events:525:35)
    at Pipe.<anonymous> (node:net:757:14)
error   | [Exception] AutoRest extension '@autorest/python' terminated.

I was able to reproduce this locally (as you can see from the paths in the snips above), by doing:

node_modules/autorest/entrypoints/app.js –reset
node_modules/autorest/entrypoints/app.js --az --python --use=@autorest/[email protected] --azure-validator --version=3.7.6 --debug --help

Expected behavior
The expectation is that the help command output is produced without exception.

Additional context
autorest3.6.2exception.log
autorest3.6.1success.log

@bryan-strassner bryan-strassner changed the title TypeError: extension.updatePythonPath is not a function after az 3.6.2 was made available. TypeError: extension.updatePythonPath is not a function after CLI version 3.6.2 was made available. Jul 21, 2022
@timotheeguerin
Copy link
Member

Guessing this is an issue with the dependency not being pinned.
Can you update the python generator version with --use=@autorest/[email protected]. I believe there is also some other issues with older version of the python generator and its python dependencies.

@bryan-strassner
Copy link
Member Author

Yes- have tried pinning to 5.19.0. It fails with a different problem. In fact, other versions > 5.4.0 gets this error. I've also tried 5.5.0, 6.1.1:

fatal   | Process() cancelled due to exception : Cannot resolve pipeline stage 'python/namer' for stage 'az/merger'. Looked for pipeline stages:
 - az/python/namer
 - python/namer
 / Error: Cannot resolve pipeline stage 'python/namer' for stage 'az/merger'. Looked for pipeline stages:
 - az/python/namer
 - python/namer

See log attached:
autorest3.6.1wPy5.19.0.failure.log

@timotheeguerin
Copy link
Member

timotheeguerin commented Jul 21, 2022

can you remove --az and --azure-validator those depends on autorest v2 (have to either run that or the v3 generators)

@bryan-strassner
Copy link
Member Author

This indeed succeeds in running but doesn't change that there was a behavior change... back to the drawing board I suppose.

The goal here is to preinstall modules, such that we can use autorest to:
--az to generate a CLI extension
--go to generate a go SDK
--azure-validator --semantic-validator=true --model-validator=true --openapi-type=arm to validate swagger

Seems quite the maze of dependencies and not a real clear way to achieve all in the same environment. (what we had before worked until 2 days ago... but maybe we're doing it wrong !!!)

Any thoughts or guidance on a path?

@timotheeguerin
Copy link
Member

timotheeguerin commented Jul 21, 2022

Agree with you that autorest dependency is a mess, the ability to get download on the fly make you loose the ability to have locked dependencies which cause those issues where things randomly start failing due to a dep of a dep getting updated.

For the v2 vs v3 problem this is also indeed frustrating but v2 has been deprecated for a while as well, I can't tell why they still haven't updated their extension to v3.

If you want to preload things you can always them one by one and all the various different version should get installed and be ready for next use.
--use also accept a path to a local folder. You could add all the dependencies to a package.json, run npm install have a lock file that lock all deps and then use --use=./node_modules/@auorest/python, etc.

Which command was working well 2 days ago, the 1st one on the issue? Did you have the packages cached on your machine by chance?

@bryan-strassner
Copy link
Member Author

Yes, the first command on the issue is what changed behavior in our pipelines. Yes, the local worked due to cached resources. I agree that the dep-of-a-dep, and ">" ranged dependency specifications are exactly what bit us.

Good to know on the --use. I wasn't aware that it accepted a full path. Thanks!

As a temporary work-around, we bundled up one developer's cached dependencies as an archive and unarchive it in the pipeline. This is obviously not ideal, but it unblocked us for the time being.

@vtahiliani
Copy link

vtahiliani commented Jul 28, 2022

I have been facing similar issues with python version:5.4.0, core: 3.7.6 and cli: 3.6.2
Is there any working compatible version for autorest cli generation? Any thoughts or guidance on a path?

-------------------------------------------- Logs: -----------------------------------------------------
info | Loading AutoRest extension '@autorest/az' (latest->1.8.0)
info | Installing AutoRest extension '@autorest/python' (5.4.0 -> 5.4.0)
installing... [========================================] 100% | 580/580
info | Installed AutoRest extension '@autorest/python' (5.4.0->5.4.0)
info | Loading AutoRest extension '@autorest/clicommon' (0.6.2->0.6.2)
info | Loading AutoRest extension '@autorest/modelerfour' (4.15.421->4.15.421)
TypeError: extension.updatePythonPath is not a function
fatal | Process() cancelled due to failure
error | [Exception] AutoRest extension '@autorest/python' terminated.
error | Error: [Exception] AutoRest extension '@autorest/python' terminated.

@bfjelds
Copy link
Member

bfjelds commented Jul 28, 2022

Our team is seeing this as well when trying to create an az cli sdk:

> autorest --az  .\readme.md
AutoRest code generation utility [cli version: 3.6.2; node: v18.4.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
info    |    Loading AutoRest core      'C:\Users\bfjelds\.autorest\@[email protected]\nodemodules\@autorest\core\dist' (3.9.0)
info    |    Loading AutoRest extension '@autorest/az' (latest->1.8.0)
info    |    Loading AutoRest extension '@autorest/python' (5.4.0->5.4.0)
info    |    Loading AutoRest extension '@autorest/clicommon' (0.6.2->0.6.2)
info    |    Loading AutoRest extension '@autorest/modelerfour' (4.15.421->4.15.421)
TypeError: extension.updatePythonPath is not a function
fatal   | Process() cancelled due to failure 
error   | [Exception] AutoRest extension '@autorest/python' terminated.
error   |   Error: [Exception] AutoRest extension '@autorest/python' terminated.
error   | Autorest completed with an error. If you think the error message is unclear, or is a bug, please declare an issues at https://github.com/Azure/autorest/issues with the error message you are seeing.

Any help in understanding how we can workaround this would be super appreciated!

@timotheeguerin
Copy link
Member

You can find the particular issue with using --az here Azure/autorest.az#893 with a workaround described here https://github.com/Azure/autorest.az#take-logz-extension-as-a-dry-run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants