serverless-next.js: "InvalidArgument: The parameter MinTTL is required" for older serverless-nextjs versions (1.16 and below)

Describe the bug Deployments suddenly broke for older version 1.16 and below and throws InvalidArgument: The parameter MinTTL is required.

Recent changes to TTL may caused that as serverless-nextjs might pick latest aws-cloudfront version

To Reproduce deploy any simple website with almost zero config with @sls-next/serverless-component@1.16.0

Expected behavior

Expect to not throw

Desktop (please complete the following information):

  • OS: MacOS and Linux tested
  • Serverless-nextjs version: @sls-next/serverless-component@1.16.0

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 22 (5 by maintainers)

Most upvoted comments

@himynameistimli for now I published @sls-next/serverless-component@1.15.0-patch.0 (which is 1.15.0) with exact dependencies (https://www.npmjs.com/package/@sls-next/serverless-component/v/1.15.0-patch.0) so it should resolve this issue. Let me know if this works.

@Bryceacampbell Please try latest 1.17.0 version (not alpha), as mentioned above there was a dependency versioning issue that caused old component versions to pull newer dependency versions. Unfortunately we can’t republish older versions to npm 😦

It should be because the publish step was publishing non-exact versions of the dependencies, so it may pick later versions of the dependencies. I fixed it here: https://github.com/serverless-nextjs/serverless-next.js/commit/ecce5e90b61f4eb763eb8a393de90001e1da88f7, but it would only apply for the recent releases and future release.

Not sure how we can fix this for previous versions, as I don’t think NPM allows republishing an older version anymore. Any thoughts @danielcondemarin?

I would recommend to upgrade to 1.17. If you are using custom cache behavior, note that you now should specify all TTLs (minTTL, maxTTL, defaultTTL): https://github.com/serverless-nextjs/serverless-next.js#custom-cloudfront-configuration.

@dabit3 Npm doesn’t allow republishing the same package version (due to some past incidents where a package was unpublished and broke a lot of other packages) so nothing changed for 1.16, which doesn’t use pinned dependencies.

If it started working I’m not sure why, perhaps it’s picking up some different dependency version that is somehow compatible with your configuration.

It’s recommended to go to 1.17 or later where internal dependencies are pinned.

If there’s still any issue upgrading, please let me know and I can publish a patch for 1.16 if needed (I did for 1.15 as requested).

@paleite thanks! We will look into tagging the versions differently so we can have a separate stable/alpha release

@himynameistimli if you are able to repro your issue and share it, I can take a better look at what’s happening.

In meanwhile perhaps we could republish a 1.15 & 1.16 under a new version e.g 1.15-patch and 1.16-patch as a one time thing (with pinned dependencies) as a temp workaround? @danielcondemarin any thoughts how to do it? We just need to checkout the 1.15 and 1.16 tags and add --exact to the publish commands and I guess manually re-version them, though I’m not as familiar with Lerna so maybe you have a better idea.

@Bryceacampbell Please try latest 1.17.0 version (not alpha), as mentioned above there was a dependency versioning issue that caused old component versions to pull newer dependency versions. Unfortunately we can’t republish older versions to npm 😦

Thank you, this solved my issue and everything works fine.

Ah this was my bad. I installed a new version but forgot to update the serverless.yml file so serverless file had 1.17.0-alpha.9 but I had 1.17.0-alpha13 and also tested out 1.17.0 without editing serverless file.

I updated the serverless.yml and re-deployed and all is good. The default TTLs were fine so I don’t have any config besides

name: actions

actionsNextApp:
  component: "@sls-next/serverless-component@1.17.0"
  inputs:
    useServerlessTraceTarget: true
    domain:
      - ${env.SUB_DOMAIN}
      - ${env.DOMAIN}
    memory: 2048