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

Access denied after deploy using versions since locale data copying #907

Closed
2 tasks done
raffij opened this issue Feb 26, 2021 · 3 comments · Fixed by #910
Closed
2 tasks done

Access denied after deploy using versions since locale data copying #907

raffij opened this issue Feb 26, 2021 · 3 comments · Fixed by #910

Comments

@raffij
Copy link
Contributor

raffij commented Feb 26, 2021

Describe the bug

Actual behavior

We updated from beta.9 to beta.32 to take advantage of locale based urls, but it's causing us issues as it appears non of the localised files are being copied to the s3 bucket.

Expected behavior

Being able to access the website

Steps to reproduce

Build a nextjs project with locale based routes and try to deploy.

Screenshots/Code/Logs

// next.config.js
module.exports = {
  i18n: {
    localeDetection: false,
    locales: ['none', 'en-GB', 'en-US'],
    defaultLocale: 'none',
  },
});

Think all the s3 copying functions are creating incorrect source paths:
https://github.com/serverless-nextjs/serverless-next.js/blob/master/packages/libs/lambda-at-edge/src/build.ts#L964-L968

Such as:

From: /.next/serverless/pages/en-US/en-GB/young-adults.html
To: /.serverless_nextjs/assets/static-pages/jzSOVgLFfMMvDiWCloqWC/en-US/en-GB/young-adults.html

Versions

  • OS/Environment:
  • @sls-next/serverless-component version: beta.32
  • Next.js version: 10.0.7

Checklist

  • You have reviewed the README and FAQs, which answers several common questions.
  • Please first try using the most recent latest or alpha @sls-next/serverless-component release version, which may have already fixed your issue or implemented the feature you are trying to use. Note that the old serverless-next.js component and the serverless-next.js plugin are deprecated and no longer maintained.
@raffij
Copy link
Contributor Author

raffij commented Feb 28, 2021

I think the issue is related to vercel/next.js#21404 where the prerender-manifest.json version has been updated as locale based urls are handled differently now.

@dphang
Copy link
Collaborator

dphang commented Mar 2, 2021

Yes, looks like in newer versions they started generating an entry per locale in prerender manifest like so:

{
  "version": 3,
  "routes": {
    "/en/ssg-page": {
      "initialRevalidateSeconds": false,
      "srcRoute": null,
      "dataRoute": "/_next/data/pAxnSn-EEbDUuH11moQ1L/ssg-page.json"
    },
    "/fr/ssg-page": {
      "initialRevalidateSeconds": false,
      "srcRoute": null,
      "dataRoute": "/_next/data/pAxnSn-EEbDUuH11moQ1L/ssg-page.json"
    },
    "/en": {
      "initialRevalidateSeconds": false,
      "srcRoute": null,
      "dataRoute": "/_next/data/pAxnSn-EEbDUuH11moQ1L/index.json"
    },
    "/fr": {
      "initialRevalidateSeconds": false,
      "srcRoute": null,
      "dataRoute": "/_next/data/pAxnSn-EEbDUuH11moQ1L/index.json"
    },
    "/en/image-component": {
      "initialRevalidateSeconds": false,
      "srcRoute": null,
      "dataRoute": "/_next/data/pAxnSn-EEbDUuH11moQ1L/image-component.json"
    },
    "/fr/image-component": {
      "initialRevalidateSeconds": false,
      "srcRoute": null,
      "dataRoute": "/_next/data/pAxnSn-EEbDUuH11moQ1L/image-component.json"
    }
  },
  "dynamicRoutes": {},
  "notFoundRoutes": [],
  "preview": {
    "previewModeId": "71176bbe3e832b7b22609daebeb4a7c8",
    "previewModeSigningKey": "2b3a1ccf72b1efd9941b7ef18859e75f907f980fb7302e7b9273de8a6e9d701b",
    "previewModeEncryptionKey": "76f4771cc2eef429b1eaa8bfa76279354986d79ed8ddd8314fb36eaccab0edb1"
  }
}

Will update the logic to check the prerender manifest version and act accordingly.

@raffij
Copy link
Contributor Author

raffij commented Mar 2, 2021

Confirming 33 is now deploying as expected for us. Thanks for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants