-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Adding a serverless.js file breaks expected functionality for Next.js Serverless Component with next-i18next support #8503
Comments
The way next-18n works is that it expects locales to be in the local filesystem (Lambda in this case), however the
import NextJsComponent from "@sls-next/serverless-component"; or const NextJsComponent = require("@sls-next/serverless-component"); for the latest Serverless-next.js component version. TypeScript definitions are in Also, for: const NextJsComponent = require("serverless-next.js/serverless"); ^ this one seems to be for an older version of serverless-next.js, maybe the old Note that overriding methods this way might mean that you might not get latest updates if our component changes; you'd have to manually sync it yourself. I think that error happens when Serverless can't resolve the component, then treats it like a regular Serverless framework app, not Serverless Components (it has to extend Component which is from Serverless). |
Wow! Thank you @dphang for the in-depth reply!
This seems like a totally logical way to copy over the locales files. I don't know why I didn't think of/see this in the README.
I've just tried adding the Serverless Error ---------------------------------------
"service" property is missing in serverless.yml
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: linux
Node Version: 12.18.1
Framework Version: 2.11.1 (standalone)
Plugin Version: 4.1.2
SDK Version: 2.3.2
Components Version: 3.3.0 I'm starting to think that I'm going to try using the postBuildCommands suggestion now and see where I get! Thank you again! |
Sure, I am not sure if they removed |
I thought so too. Maybe, as you say, I'm pointing it at an invalid |
@kylekirkby thanks for report, but I believe this belongs to https://github.com/serverless-nextjs/serverless-next.js and not here. Can you open this issue over there? |
I'm trying to deploy the infrastructure required running a multi-environment next.js app with i18n support. There is an issue where the
@sls-next/serverless-component
fails to add the translation JSON files to thedefault-lambda
src. Someone in another issue (serverless-nextjs/serverless-next.js#383 (comment)) suggested extending thesls-next/serverless-component
with aserverless.js
file. This seems logical and great until adding this file breaks everything else. Adding aserverless.js
file to extend a component results inserverless
requiring aservice
andprovider
property but then still fails to deploy as expected.serverless.yml
serverless.js
npx serverless
outputInstalled version
The text was updated successfully, but these errors were encountered: