kubb-labs / kubb

The ultimate toolkit for working with APIs.
https://kubb.dev
MIT License
728 stars 67 forks source link

pluginTs - ERROR <App/> should be set (plugin: plugin-ts, hook: buildStart) #1379

Closed MetaCrawler closed 1 day ago

MetaCrawler commented 4 days ago

What version of kubb is running?

3.0.1

What platform is your computer?

Windows + WSL2 (Ubuntu 22.04.1 LTS) + VsCode + Devcontainer typescript-node:1-22

What version of external packages are you using(@tanstack-query, MSW, React, Vue, ...)

"@kubb/cli": "^3.0.1",     "@kubb/core": "^3.0.1",     "@kubb/plugin-client": "^3.0.1",     "@kubb/plugin-oas": "^3.0.1",     "@kubb/plugin-ts": "^3.0.1",     "@kubb/plugin-vue-query": "^3.0.1",     "@tanstack/vue-query": "^5.59.20",     "@tanstack/vue-query-devtools": "^5.59.20",

What steps can reproduce the bug?

General Info Not sure if I do something wrong or I has made a mistake by reading the migration guide... but pluginOas alone seems to run, but as soon as pluginTs is added in the config I just receive a bunch of errors when trying to run kubb.

Using: node 22.11.0 npm 10.9.0

Reproduction 1) Install named package versions. 2) Use petStore.yaml from the code sandbox. (attached in zip) 3) Use config (attached in zip) 4) kubb generate

reproduce.zip

Error Examples

[petstore 11:43:47 AM] ERROR The above error occurred in the component:

at Object.Schema (file:///workspaces/my-project/node_modules/@kubb/plugin-ts/dist/chunk-HJ6SFXKJ.js:247:12)
at Schema (file:///workspaces/my-project/node_modules/@kubb/plugin-oas/dist/chunk-GF26SDHQ.js:14:19)
at Oas (file:///workspaces/my-project/node_modules/@kubb/plugin-oas/dist/chunk-GF26SDHQ.js:19:16)
at App (file:///workspaces/my-project/node_modules/@kubb/plugin-oas/node_modules/@kubb/react/dist/index.js:769:16)
at ErrorBoundary (file:///workspaces/my-project/node_modules/@kubb/plugin-oas/node_modules/@kubb/react/dist/index.js:16:21)
at Root (file:///workspaces/my-project/node_modules/@kubb/plugin-oas/node_modules/@kubb/react/dist/index.js:39:17)

React will try to recreate this component tree from scratch using the error boundary you provided, KubbErrorBoundary.

[petstore 11:43:47 AM] ERROR The above error occurred in the component:

at ErrorBoundary (file:///workspaces/my-project/node_modules/@kubb/plugin-oas/node_modules/@kubb/react/dist/index.js:16:21)
at Root (file:///workspaces/my-project/node_modules/@kubb/plugin-oas/node_modules/@kubb/react/dist/index.js:39:17)

Consider adding an error boundary to your tree to customize error handling behavior. Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.

[petstore 11:43:47 AM] ERROR should be set (plugin: plugin-ts, hook: buildStart) (plugin: plugin-ts, hook: buildStart)

at EventEmitter. (node_modules/@kubb/core/src/logger.ts:93:19) at EventEmitter.emit (node:events:518:28) at EventEmitter.emit (node_modules/@kubb/core/src/utils/EventEmitter.ts:10:19) at Object.emit (node_modules/@kubb/core/src/logger.ts:111:21) at PluginManager.#catcher (node_modules/@kubb/core/src/PluginManager.ts:637:17) at node_modules/@kubb/core/src/PluginManager.ts:383:26 at Array.forEach () at PluginManager.hookParallel (node_modules/@kubb/core/src/PluginManager.ts:379:13) at processTicksAndRejections (node:internal/process/task_queues:105:5) at safeBuild (node_modules/@kubb/core/src/build.ts:82:5) at generate (node_modules/@kubb/cli/src/generate.ts:84:43) at Object.run (node_modules/@kubb/cli/src/commands/generate.ts:106:5) at runCommand (node_modules/citty/dist/index.mjs:316:16) at runCommand (node_modules/citty/dist/index.mjs:307:11) at runMain (node_modules/citty/dist/index.mjs:445:7) at run (node_modules/@kubb/cli/src/index.ts:49:3)

How often does this bug happen?

Every time

What is the expected behavior?

Types should be generated without error.

Swagger/OpenAPI file?

The same as from the codesandbox example in the docs. (also attached in the above .zip file) https://codesandbox.io/p/devbox/happy-dhawan-jkhmyd?file=%252FpetStore.yaml

Additional information

Thank you for all your work & support. Kubb in general is awesome.

linear[bot] commented 4 days ago

KUBB-62 pluginTs - ERROR <App/> should be set (plugin: plugin-ts, hook: buildStart)

cthompson-avb commented 4 days ago

the only configuration I can get to do anything is having only

  plugins: [
    pluginOas({ validate: true }),
 ]

Any plugin that has an output causes the error.

The error does not exist in v3.0.0.

stijnvanhulle commented 3 days ago

Can you try running it with the debug log so you have some logs and maybe also send your package.json? https://www.kubb.dev/helpers/cli#debug

I have tried your config with the petstore.yaml and seems to work fine(no errors), not sure what is going on

MetaCrawler commented 1 day ago

I think this can be closed. Updated to 3.0.3 and it works now.

Anyway, if you still need the debug log, let me know. Then I will revert to 3.0.1 and do so.