Skip to content
This repository was archived by the owner on May 10, 2021. It is now read-only.

i18n fails to build #71

Closed
victorhqc opened this issue Nov 2, 2020 · 9 comments
Closed

i18n fails to build #71

victorhqc opened this issue Nov 2, 2020 · 9 comments

Comments

@victorhqc
Copy link

victorhqc commented Nov 2, 2020

Hello πŸ‘‹

I noticed that I can't build my site when using the new i18n feature. I built dummy repository in which I reproduce the issue.

Page                                                           Size     First Load JS
β”Œ β—‹ /                                                          3.44 kB        65.9 kB
β”œ   /_app                                                      0 B            62.5 kB
β”œ β—‹ /404                                                       3.44 kB        65.9 kB
β”œ Ξ» /api/hello                                                 0 B            62.5 kB
β”” ● /hello                                                     3.45 kB        65.9 kB
+ First Load JS shared by all                                  62.5 kB
  β”œ chunks/f6078781a05fe1bcb0902d23dbbb2662c8d200b3.6d88ef.js  11.4 kB
  β”œ chunks/framework.9116e7.js                                 41.8 kB
  β”œ chunks/main.fa2ed4.js                                      7.99 kB
  β”œ chunks/pages/_app.333f97.js                                529 B
  β”œ chunks/webpack.e06743.js                                   751 B
  β”” css/6e9ef204d6fd7ac61493.css                               194 B

Ξ»  (Lambda)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
β—‹  (Static)  automatically rendered as static HTML (uses no initial props)
●  (SSG)     automatically generated as static HTML + JSON (uses getStaticProps)
   (ISR)     incremental static regeneration (uses revalidate in getStaticProps)


> serverless-i18n@0.1.0 postbuild C:\Users\<user>\Code\serverless-i18n
> next-on-netlify

οΏ½ Next on Netlify οΏ½
   Functions directory: out_functions\
   Publish directory:   out_publish\
   Make sure these are set in your netlify.toml file.
�️ Copying public\ folder to out_publish\
οΏ½ Copying static NextJS assets to out_publish\
οΏ½ Setting up API endpoints as Netlify Functions in out_functions\
   pages/api/hello.js
οΏ½ Setting up pages with getInitialProps as Netlify Functions in out_functions\
οΏ½ Setting up pages with getServerSideProps as Netlify Functions in out_functions\
οΏ½ Copying pre-rendered pages with getStaticProps and JSON data to out_publish\
   /hello
internal/fs/utils.js:298
    throw err;
    ^

Error: ENOENT: no such file or directory, stat '.next\serverless\pages\hello.html'
    at Object.statSync (fs.js:1042:3)
    at Object.statSync (C:\Users\<user>\Code\serverless-i18n\node_modules\graceful-fs\polyfills.js:307:34)
    at statSync (C:\Users\<user>\Code\serverless-i18n\node_modules\fs-extra\lib\util\stat.js:10:52)
    at getStatsSync (C:\Users\<user>\Code\serverless-i18n\node_modules\fs-extra\lib\util\stat.js:24:19)
    at Object.checkPathsSync (C:\Users\<user>\Code\serverless-i18n\node_modules\fs-extra\lib\util\stat.js:49:33)
    at copySync (C:\Users\<user>\Code\serverless-i18n\node_modules\fs-extra\lib\copy-sync\copy-sync.js:24:38)
    at setupStaticFileForPage (C:\Users\<user>\Code\serverless-i18n\node_modules\next-on-netlify\lib\helpers\setupStaticFileForPage.js:11:3)
    at C:\Users\<user>\Code\serverless-i18n\node_modules\next-on-netlify\lib\pages\getStaticProps\setup.js:26:5
    at Array.forEach (<anonymous>)
    at setup (C:\Users\<user>\Code\serverless-i18n\node_modules\next-on-netlify\lib\pages\getStaticProps\setup.js:21:9) {
  errno: -4058,
  syscall: 'stat',
  code: 'ENOENT',
  path: '.next\\serverless\\pages\\hello.html'
}

Te repository that reproduces the issue can be accessed here, just run the following

npm i
npm run build

It is a standard next.js application using:

  • next: 10.0.0
  • next-on-netlify: 2.6.0

Something interesting to note is that the site builds correctly when I omit the getStaticProps in hello.js.

@lindsaylevine
Copy link
Contributor

hey @victorhqc thanks so much for reporting this and for the repro repository πŸ™ it seems like in next 10, when i18n is included in your next config, the statically generated html now sits in a different folder in the build directory (under each locale), instead of at the path where next-on-netlify is currently looking and erroring aka .next/serverless/pages/hello.html. it's now .next/serverless/pages/{locale}/hello.html. i think we'll have to make some changes to next-on-netlify to accommodate this. we will keep you updated!!!

@georgekpc
Copy link

One way to get this working is with Netlify redirects. It's a hacky, not elegant and maintanable at all approach however it gets the job done.

@lindsaylevine
Copy link
Contributor

@georgekpc @victorhqc i'm currently working on this alongside some other work, hoping to have a PR open by end of week

@TejasQ
Copy link

TejasQ commented Nov 30, 2020

One way to get this working is with Netlify redirects. It's a hacky, not elegant and maintanable at all approach however it gets the job done.

How?

I need this functionality to satisfy a client. 😬

@lindsaylevine
Copy link
Contributor

@TejasQ do you want to try to install #75 this branch (ll/i18n) in your project in the meantime? its not fully functional at the moment (see comments) but it's in progress and trying to get it shipped asap.

@TejasQ
Copy link

TejasQ commented Nov 30, 2020

Yes! I asked if we could get a prerelease out there. #75 (comment)

@lindsaylevine
Copy link
Contributor

@TejasQ ah so sorry missed it when i saw justin's longer comment πŸ’€ will address that comment!

@diogolessa
Copy link

same problem here @victorhqc

@lindsaylevine lindsaylevine added this to the Next 10 features milestone Dec 18, 2020
@lindsaylevine lindsaylevine pinned this issue Dec 20, 2020
nocategory referenced this issue in nocategory/portfolio Jan 3, 2021
@lindsaylevine
Copy link
Contributor

merged #75, releasing shortly!

@lindsaylevine lindsaylevine unpinned this issue Jan 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants