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

nuxi generate fetches api #28

Closed
tobiasdiez opened this issue Nov 16, 2021 · 5 comments
Closed

nuxi generate fetches api #28

tobiasdiez opened this issue Nov 16, 2021 · 5 comments
Labels
bridge bug Something isn't working nitro

Comments

@tobiasdiez
Copy link
Contributor

Environment

  • Operating System: Windows_NT
  • Node Version: v17.0.1
  • Nuxt Version: 2.16.0-27273615.ab1c6cb4
  • Package Manager: yarn@1.22.15
  • Bundler: Webpack
  • User Config: target, bridge, vite, alias, nitro, ssr, head, css, plugins, components, tailwindcss, buildModules, modules, serverMiddleware, watch, privateRuntimeConfig, build, storybook
  • Runtime Modules: -
  • Build Modules: @nuxtjs/tailwindcss@4.2.1, portal-vue/nuxt, @nuxt/postcss8@1.1.3, @pinia/nuxt@0.1.0, nuxt-route-meta@2.3.2, @nuxt/bridge@3.0.0-27283410.c53b6a5

Reproduction

JabRef/JabRefOnline#480, and in particular the "build" step in https://github.com/JabRef/JabRefOnline/runs/4218058544?check_suite_focus=true

Describe the bug

nuxi generate tries to access the api hosted at localhost during server build. On github workflow, this fails with the following error

``̀
Network error FetchError: request to http://localhost:3000/api failed, reason: connect ECONNREFUSED 127.0.0.1:3000

at file:///home/runner/work/JabRefOnline/JabRefOnline/node_modules/.cache/nuxt/nitro/index.mjs:62754:14
at Object.error (file:///home/runner/work/JabRefOnline/JabRefOnline/node_modules/.cache/nuxt/nitro/index.mjs:62557:29)
at notifySubscription (file:///home/runner/work/JabRefOnline/JabRefOnline/node_modules/.cache/nuxt/nitro/index.mjs:56593:13)
at onNotify (file:///home/runner/work/JabRefOnline/JabRefOnline/node_modules/.cache/nuxt/nitro/index.mjs:56632:3)
at SubscriptionObserver2.error (file:///home/runner/work/JabRefOnline/JabRefOnline/node_modules/.cache/nuxt/nitro/index.mjs:56673:5)
at file:///home/runner/work/JabRefOnline/JabRefOnline/node_modules/.cache/nuxt/nitro/index.mjs:57747:18
at processTicksAndRejections (node:internal/process/task_queues:96:5)

``̀

Additional context

No response

Logs

No response

@danielroe
Copy link
Member

@tobiasdiez I really appreciate your raising these issues. Would it be possible to provide minimal reproductions rather than the project you're working on? It would make a big difference in terms of being able to quickly pull something up to see what the issue is.

@tobiasdiez
Copy link
Contributor Author

I understand your concern and will try to create minimal reproductions. However, it is rather hard for me to do this, as I usually have no clue why I encounter these errors. They just pop up without any context, and I don't really know why. It would be way easier to give minimal reproductions if I would start from zero and add say further dependencies or change config options; because then I would know or at least have a guess that these changes triggered the issue.

@tobiasdiez
Copy link
Contributor Author

I found the place where the API is called. Going forwards:
https://github.com/nuxt/framework/blob/496ea0977702c2e0e5c0c3d89e55ee2ce36cbed6/packages/bridge/src/nitro.ts#L166-L169
calls the reload function defined here
https://github.com/nuxt/framework/blob/1e69bc56bb3efbb1b1ab6001006f8f96efaf2622/packages/nitro/src/server/dev.ts#L63-L72
The call to initWorker triggers the execution/evaluation of the api server entry point.

I'm not sure what reload is supposed to do in this context, but if I uncomment the call to reload in the extendRoutes hook than everything is working fine (as far as I can see).

@pi0
Copy link
Member

pi0 commented Apr 12, 2022

@tobiasdiez Can you still reproduce it?

@danielroe danielroe transferred this issue from nuxt/framework Apr 13, 2022
@danielroe
Copy link
Member

This should now be resolved with #324. Let me know if not and we can reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bridge bug Something isn't working nitro
Projects
None yet
Development

No branches or pull requests

3 participants