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

ERROR [h3] [unhandled] Expected input to be a string #985

Closed
Moxxxem opened this issue Nov 23, 2023 · 5 comments
Closed

ERROR [h3] [unhandled] Expected input to be a string #985

Moxxxem opened this issue Nov 23, 2023 · 5 comments

Comments

@Moxxxem
Copy link

Moxxxem commented Nov 23, 2023

Environment


  • Operating System: Linux
  • Node Version: v18.18.2
  • Nuxt Version: 2.17.2-28284499.5674f49
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.0
  • Package Manager: npm@9.8.1
  • Builder: webpack
  • User Config: bridge, env, server, buildModules, svgSprite, modules, plugins, router, axios, proxy, pwa, head, css, styleResources, loading, hooks, build, serverHandlers, devServerHandlers, devServer, typescript, nitro
  • Runtime Modules: @nuxtjs/axios@5.13.6, @nuxtjs/style-resources@1.2.1, cookie-universal-nuxt@2.2.2, nuxt-validate@1.0.1
  • Build Modules: (), @nuxtjs/pwa@3.3.5, @nuxtjs/svg-sprite@0.5.2, @nuxt/bridge@3.0.0-rc.3-28343365.3c40b3f

Reproduction

After installing nuxt bridge and turn on bridge: true in nuxt.config.js, change 'nuxt' to 'nuxi' in package.json, reinstall dependencies run 'npm run dev'.

Describe the bug

After running app, next compiling client and server, after compiling i'm open localhost and have
{
"statusCode": 500,
"stack": []
}
on the screen and
ERROR [h3] [unhandled] Expected input to be a string
at the console

Additional context

Before compiling nuxt throw ERROR [worker reload] Cannot read properties of null (reading 'address') at console, but after compiling nitro builded correctly

Logs

ERROR  [worker reload] Cannot read properties of null (reading 'address')                                                                                 1:23:38 PM

  at _reload (node_modules/nitropack/dist/shared/nitro.37241ef0.mjs:282:38)
  at runNextTicks (node:internal/process/task_queues:60:5)
  at process.processTimers (node:internal/timers:509:9)
  at async _applyPromised (node_modules/perfect-debounce/dist/index.mjs:54:10)

ℹ Watching ~/assets/icons/ for new icons                                                                                                  @nuxtjs/svg-sprite 13:23:46

 ERROR  [worker reload] Cannot read properties of null (reading 'address')                                                                                 1:23:46 PM

  at _reload (node_modules/nitropack/dist/shared/nitro.37241ef0.mjs:282:38)
  at async _applyPromised (node_modules/perfect-debounce/dist/index.mjs:54:10)

✔ Nitro built in 269 ms                                                                                                                             nitro 1:23:46 PM
ℹ Waiting for file changes                                                                                                                                1:23:46 PM

 ERROR  [h3] [unhandled] Expected input to be a string                                                                                                     1:23:52 PM

  at picomatch.test (node_modules/picomatch/lib/picomatch.js:119:11)
  at matcher (node_modules/picomatch/lib/picomatch.js:67:50)
  at micromatch (node_modules/micromatch/index.js:49:21)
  at matchSingleGlobPath (node_modules/http-proxy-middleware/dist/context-matcher.js:46:21)
  at Object.match (node_modules/http-proxy-middleware/dist/context-matcher.js:15:16)
  at HttpProxyMiddleware.shouldProxy (node_modules/http-proxy-middleware/dist/http-proxy-middleware.js:86:35)
  at HttpProxyMiddleware.<anonymous> (node_modules/http-proxy-middleware/dist/http-proxy-middleware.js:28:22)
  at Generator.next (<anonymous>)
  at node_modules/http-proxy-middleware/dist/http-proxy-middleware.js:8:71
  at new Promise (<anonymous>)
  at __awaiter (node_modules/http-proxy-middleware/dist/http-proxy-middleware.js:4:12)
  at HttpProxyMiddleware.middleware [as handler] (node_modules/http-proxy-middleware/dist/http-proxy-middleware.js:26:47)
  at Object.handler (node_modules/h3/dist/index.mjs:1675:31)
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at async NuxtDevServer.toNodeHandle [as _handler] (node_modules/nuxi/dist/shared/nuxi.a4b9172a.mjs:648:7)


 ERROR  [h3] [unhandled] Expected input to be a string                                                                                                     1:23:52 PM

  at picomatch.test (node_modules/picomatch/lib/picomatch.js:119:11)
  at matcher (node_modules/picomatch/lib/picomatch.js:67:50)
  at micromatch (node_modules/micromatch/index.js:49:21)
  at matchSingleGlobPath (node_modules/http-proxy-middleware/dist/context-matcher.js:46:21)
  at Object.match (node_modules/http-proxy-middleware/dist/context-matcher.js:15:16)
  at HttpProxyMiddleware.shouldProxy (node_modules/http-proxy-middleware/dist/http-proxy-middleware.js:86:35)
  at HttpProxyMiddleware.<anonymous> (node_modules/http-proxy-middleware/dist/http-proxy-middleware.js:28:22)
  at Generator.next (<anonymous>)
  at node_modules/http-proxy-middleware/dist/http-proxy-middleware.js:8:71
  at new Promise (<anonymous>)
  at __awaiter (node_modules/http-proxy-middleware/dist/http-proxy-middleware.js:4:12)
  at HttpProxyMiddleware.middleware [as handler] (node_modules/http-proxy-middleware/dist/http-proxy-middleware.js:26:47)
  at Object.handler (node_modules/h3/dist/index.mjs:1675:31)
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at async NuxtDevServer.toNodeHandle [as _handler] (node_modules/nuxi/dist/shared/nuxi.a4b9172a.mjs:648:7)
@wattanx
Copy link
Collaborator

wattanx commented Nov 23, 2023

This will be resolved in the next patch release of nitro.
ref: nuxt/nuxt#24423

@Moxxxem
Copy link
Author

Moxxxem commented Nov 23, 2023

This will be resolved in the next patch release of nitro. ref: nuxt/nuxt#24423

Ty for answer, but i have trouble with "Expected input to be a string" error after application compiling (below nitro errors in logs)

@wattanx
Copy link
Collaborator

wattanx commented Nov 24, 2023

The error 'Expected input to be a string' seems to be caused by a module you are using, not by nuxt/bridge.
Can you provide an environment where this can be reproduced? (I couldn't reproduce it with the steps you've written.)
https://stackblitz.com/github/nuxt/starter/tree/v2-bridge

@Moxxxem
Copy link
Author

Moxxxem commented Nov 24, 2023

Reproduce it with my config & package.json, ty for help:
https://stackblitz.com/edit/github-ewdyxk

@Moxxxem
Copy link
Author

Moxxxem commented Nov 28, 2023

Solve this problem. Remove @nuxtjs/axios from modules and remove axios and proxy from config.

Removed:

  axios: {
    credentials: true,
    proxy: true
  },
  proxy: {
    '/api/**': {
      target: process.env.API_URL,
      secure: false,
      changeOrigin: true,
      pathRewrite: { '^/api': '' },
      headers: {
        Connection: 'keep-alive'
      }
    }
  },

Added:

nitro: {
    sourceMap: false,
    devProxy: {
      '/api/': {
        target: process.env.API_URL,
        secure: false,
        changeOrigin: true,
        pathRewrite: { '^/api': '' },
        headers: {
          Connection: 'keep-alive'
        }
      }
    }
  }

@Moxxxem Moxxxem closed this as completed Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants