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

[Bug]: @typespec/openapi3 - TypeError: Cannot read properties of undefined (reading 'add') #4272

Closed
4 tasks done
btiernay opened this issue Aug 26, 2024 · 1 comment
Closed
4 tasks done
Labels
bug Something isn't working emitter:openapi3 Issues for @typespec/openapi3 emitter needs-area triaged:core

Comments

@btiernay
Copy link

btiernay commented Aug 26, 2024

Describe the bug

The following will crash the compiler:

import "@typespec/http";

using TypeSpec.Http;

@service({title: "test"})
@useAuth(TestModel)
namespace TestNamespace {
    op call(): void;
}

model TestModel {}

With this output:

Internal compiler error!  
File issue at https://github.com/microsoft/typespec

ExternalError: Emitter "@typespec/openapi3" crashed! This is a bug.  
Please file an issue at https://github.com/microsoft/typespec/issues

TypeError: Cannot read properties of undefined (reading 'add')  
at getOpenAPI3SchemeInternal (file:///node_modules/@typespec/openapi3/dist/src/openapi.js:1288:29)
at getOpenAPI3Scheme (file:///node_modules/@typespec/openapi3/dist/src/openapi.js:1254:24)
at getOpenAPISecuritySchemes (file:///node_modules/@typespec/openapi3/dist/src/openapi.js:1217:28)
at initializeEmitter (file:///node_modules/@typespec/openapi3/dist/src/openapi.js:153:33)
at getOpenApiFromVersion (file:///node_modules/@typespec/openapi3/dist/src/openapi.js:419:13)
at getProjectedOpenAPIDocument (file:///node_modules/@typespec/openapi3/dist/src/openapi.js:307:36)
at getOpenAPI (file:///node_modules/@typespec/openapi3/dist/src/openapi.js:258:40)
at Object.emitOpenAPI (file:///node_modules/@typespec/openapi3/dist/src/openapi.js:106:32)
at Object.$onEmit [as emitFunction] (file:///node_modules/@typespec/openapi3/dist/src/openapi.js:25:19)
at runEmitter (file:///node_modules/@typespec/compiler/dist/src/core/program.js:452:27)

--------------------------------------------------  
Library Version                0.59.1  
TypeSpec Compiler Version      0.59.1  
--------------------------------------------------  
at runEmitter (file:///node_modules/@typespec/compiler/dist/src/core/program.js:455:19)
at async compile (file:///node_modules/@typespec/compiler/dist/src/core/program.js:132:9)
at async compile (file:///node_modules/@typespec/compiler/dist/src/server/compile-service.js:54:27)
at async #update (file:///node_modules/@typespec/compiler/dist/src/server/update-manager.js:30:9)

Reproduction

https://typespec.io/playground?c=aW1wb3J0ICJAdHlwZXNwZWMvaHR0cCI7Cgp1c2luZyBUeXBlU3BlYy5IdHRwOwoKQHNlcnZpY2Uoe3RpdGxlOiAidGVzdCJ9KQpAdXNlQXV0aChUZXN0TW9kZWwpCm5hbWVzcGFjZSDEFU7JDnsKICAgIG9wIGNhbGwoKTogdm9pZDsKfQoKbcQ5xS7FQyB7fQ%3D%3D&e=%40typespec%2Fopenapi3&options=%7B%7D

Checklist

@btiernay btiernay added the bug Something isn't working label Aug 26, 2024
@microsoft microsoft deleted a comment from masooddahmedd Aug 26, 2024
@microsoft microsoft deleted a comment Aug 26, 2024
@microsoft microsoft deleted a comment Aug 26, 2024
@markcowl markcowl added the emitter:openapi3 Issues for @typespec/openapi3 emitter label Aug 26, 2024
@markcowl markcowl added this to the [2024] September milestone Aug 26, 2024
@chrisradek
Copy link
Member

This is a duplicate of #4097

Just checked and looks like #4133 will fix this once merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working emitter:openapi3 Issues for @typespec/openapi3 emitter needs-area triaged:core
Projects
None yet
Development

No branches or pull requests

5 participants
@markcowl @btiernay @chrisradek and others