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

@typespec/http-server-javascript crashes for petstore #91

Open
ArcturusZhang opened this issue Jan 20, 2025 · 0 comments
Open

@typespec/http-server-javascript crashes for petstore #91

ArcturusZhang opened this issue Jan 20, 2025 · 0 comments
Assignees

Comments

@ArcturusZhang
Copy link
Collaborator

ArcturusZhang commented Jan 20, 2025

@typespec/http-server-javascript crashes for petstore when we bump its version to 0.58.0-alpha.6. Here is the stack trace:

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

SyntaxError: Unterminated string literal. (341:125)
  339 |   const nameFilter = __queryParams_51.get("nameFilter") ?? undefined;
  340 |   if (!nameFilter) {
> 341 |     __ctx_48.errorHandlers.onInvalidRequest(__ctx_48, "/pets/{petId}/toys", "missing required query parameter 'nameFilter');
      |
            ^
  342 |   }
  343 |
  344 |   const __result_49 = await __operations_50.list(__ctx_48,
    at Q4 (file:///C:/Users/dapzhang/Documents/Workspaces/typespec-e2e-demo/node_modules/prettier/plugins/typescript.mjs:17:76108)
    at x3 (file:///C:/Users/dapzhang/Documents/Workspaces/typespec-e2e-demo/node_modules/prettier/plugins/typescript.mjs:20:773)
    at Object.w3 [as parse] (file:///C:/Users/dapzhang/Documents/Workspaces/typespec-e2e-demo/node_modules/prettier/plugins/typescript.mjs:20:1164)
    at parse4 (file:///C:/Users/dapzhang/Documents/Workspaces/typespec-e2e-demo/node_modules/prettier/index.mjs:20685:24)
    at async coreFormat (file:///C:/Users/dapzhang/Documents/Workspaces/typespec-e2e-demo/node_modules/prettier/index.mjs:21146:7)
    at async formatWithCursor (file:///C:/Users/dapzhang/Documents/Workspaces/typespec-e2e-demo/node_modules/prettier/index.mjs:21348:14)
    at async Module.format2 (file:///C:/Users/dapzhang/Documents/Workspaces/typespec-e2e-demo/node_modules/prettier/index.mjs:22733:25)
    at async writeModuleFile (file:///C:/Users/dapzhang/Documents/Workspaces/typespec-e2e-demo/node_modules/@typespec/http-server-javascript/dist/src/write.js:52:11)
    at async writeModuleTree (file:///C:/Users/dapzhang/Documents/Workspaces/typespec-e2e-demo/node_modules/@typespec/http-server-javascript/dist/src/write.js:23:9)
    at async Object.$onEmit [as emitFunction] (file:///C:/Users/dapzhang/Documents/Workspaces/typespec-e2e-demo/node_modules/@typespec/http-server-javascript/dist/src/index.js:86:9)

How to reproduce:

  • uncomment @typespec/http-server-javascript in petstore/spec/tspconfig.yaml file
  • run tsp compile petstore/spec/main.tsp at root directory of this repo
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

2 participants