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

Emitter crash if no tspconfig file #2933

Closed
Tracked by #5201 ...
lmazuel opened this issue Nov 26, 2024 · 1 comment · Fixed by microsoft/typespec#5200 or #2935
Closed
Tracked by #5201 ...

Emitter crash if no tspconfig file #2933

lmazuel opened this issue Nov 26, 2024 · 1 comment · Fixed by microsoft/typespec#5200 or #2935
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved.

Comments

@lmazuel
Copy link
Member

lmazuel commented Nov 26, 2024

tspconfig is an optional file, it shouldn't be necessary.

The following steps crash the emitter:

tsp init  # Chose generic restapi
tsp install 
npm install @typespec/http-client-python
tsp compile . --emit @typespec/http-client-python

Error log:

Emitter "@typespec/http-client-python" crashed! This is a bug.
Please file an issue at https://github.com/microsoft/typespec/issues

TypeError: Cannot read properties of undefined (reading 'toLowerCase')
    at addDefaultOptions (file:///tmp/testtsp/node_modules/@typespec/http-client-python/dist/emitter/emitter.js:36:102)
    at Object.$onEmit [as emitFunction] (file:///tmp/testtsp/node_modules/@typespec/http-client-python/dist/emitter/emitter.js:60:5)
    at async runEmitter (file:///tmp/testtsp/node_modules/@typespec/compiler/dist/src/core/program.js:366:13)
    at async compile (file:///tmp/testtsp/node_modules/@typespec/compiler/dist/src/core/program.js:123:9)
    at async compileOnce (file:///tmp/testtsp/node_modules/@typespec/compiler/dist/src/core/cli/actions/compile/compile.js:36:25)
    at async compileAction (file:///tmp/testtsp/node_modules/@typespec/compiler/dist/src/core/cli/actions/compile/compile.js:19:9)
@msyyc msyyc self-assigned this Nov 27, 2024
@msyyc msyyc added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Nov 27, 2024
@msyyc
Copy link
Member

msyyc commented Nov 27, 2024

The root cause is for empty main.tsp, python emitter doesn't check whether there is valid namespace defined then crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved.
Projects
None yet
2 participants