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 Could not resolve routes, WARN No routes so not starting workers #25

Closed
kyrsquir opened this issue Mar 7, 2020 · 8 comments
Closed

Comments

@kyrsquir
Copy link

kyrsquir commented Mar 7, 2020

How to use this with an existing working (too slowly so I'm trying to speed things up) setup for regular nuxt generate? What should I pass to routes here?

nuxt.config.js:

const axios = Axios.create({
  baseURL: process.env.API_URL
})

module.exports = {
  <...>
  generate: {
    workers: 8,
    async routes() {
      const [
        { data: authors },
        { data: yearsIssues },
        { data: issues },
        { data: articles }
      ] = await Promise.all([
        axios.get(`/all_authors_contribution`),
        axios.get(`/all_issues_by_year`),
        axios.get(`/all_issues`),
        axios.get(`/articles`)
      ])
      const authorsRoutes = authors.map(entry => ({
        route: `/authors/${entry.author.author_id}`,
        payload: entry
      }))
      const yearsRoutes = yearsIssues.map(yearIssues => ({
        route: `/archive/${yearIssues.year}`,
        payload: yearIssues.issues
      }))
      const issuesRoutes = issues.map(issue => ({
        route: `/archive/${issue.feature || issue.year}/${issue.order_within_year}`,
        payload: issue
      }))
      const articlesRoutes = articles
        .filter(article => !!article.issue)
        .map(article => ({
          route: `/archive/${article.issue.feature || article.issue.year}/${article.issue.order_within_year}/${article.section.order_within_issue}/${article.order_within_section}`,
          payload: article
        }))
      return [
        ...authorsRoutes,
        ...yearsRoutes,
        ...issuesRoutes,
        ...articlesRoutes
      ]
    },
    <...>
  }
}
This question is available on Nuxt community (#c15)
@ghost ghost closed this as completed Mar 7, 2020
@ghost ghost added the cmty:question label Mar 7, 2020
@ghost
Copy link

ghost commented Mar 7, 2020

This issue as been imported as question since it does not respect nuxt-generate-cluster issue template. Only bug reports and feature requests stays open to reduce maintainers workload.
If your issue is not a question, please mention the repo admin or moderator to change its type and it will be re-opened automatically.
Your question is available at https://cmty.app/nuxt/nuxt-generate-cluster/issues/c15.

@kyrsquir
Copy link
Author

kyrsquir commented Mar 7, 2020

@pimlie Please look at this as it might actually mean a bug/feature request. Shouldn't configuration which works with nuxt generate also pass for nuxt-generate?

@pimlie
Copy link
Member

pimlie commented Mar 7, 2020

Yeah, that should just work normally. Did you make sure to first build the project by passing -b? See https://github.com/nuxt-community/nuxt-generate-cluster#command-line-options

@kyrsquir
Copy link
Author

kyrsquir commented Mar 7, 2020

Did you make sure to first build the project by passing -b

Thanks, that worked and went almost 3 times faster! I would probably mention/rephrase in the docs that it differs from nuxt generate in that it doesn't build the project by default.

I'm getting a lot of Payload-extractor had to duplicate some nested routes data in extracted payload messages during the process, could you please elaborate a bit on this message and its impact on build time and size?

@pimlie pimlie reopened this Mar 8, 2020
@pimlie
Copy link
Member

pimlie commented Mar 8, 2020

The Payload-extractor had to duplicate some nested routes data in extracted payload msg is not a message I recognize, afaik it isnt logged from this package or by Nuxt.js itself?

@kyrsquir
Copy link
Author

kyrsquir commented Mar 8, 2020

Right, sorry, forgot to mention that I'm also using nuxt payload extractor. The fact is that with regular nuxt generate I'm not getting any messages like these. Updated original post with full code of my routes() in case that helps.

I suspect that this other repo is a better place to report and discuss this. Please confirm.

@pimlie
Copy link
Member

pimlie commented Mar 8, 2020

I think its indeed better to ask in the payload extractor repo, looking at their code it isnt immediately clear to me what could be going wrong. But even after looking at the code I still dont understand what they are trying to convey with that message.

@kyrsquir
Copy link
Author

kyrsquir commented Mar 8, 2020

Ok will do, thanks.

@kyrsquir kyrsquir closed this as completed Mar 8, 2020
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