question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Service level package config is added to warmup function package config by default

See original GitHub issue

We’re creating a build which is output to dist in our project root.

In serverless.yml we have this.

package
  individually: true
  exclude:
    - ./**
  include:
    - dist/index.js

This is working fine for the main function. However, for the warmup lambda, it’s including the dist code. I’ve tried adding a package to custom.warmup but I can’t get it to be excluded.

I’ve tried lots of variations, and this is what I currently have.

warmup:
  name: alexa-custom-warmup-${opt:stage, 'dev'}
  cleanFolder: true
  prewarm: true
  package:
    individually: true
    exclude:
      - ./**
    include:
      - _warmup/index.js

Any ideas?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
juanjoDiazcommented, Jan 17, 2020

Sorry for the delay answer. Christmas holidays got on the way.

Are you setting:

package:
  individually: true
  exclude:
    - ./**
  include:
    - dist/index.js

at your function level? Or at the service level? Can you share the whole config? (of course, you can obscure the names and other sensitive stuff)

I suspect that you are setting it at the package level. Which is automatically inherited by the warmup lambda unless you override it at the warmup configuration (as you already figured out).

Maybe this was a questionable decision and the service-level package configuration shouldn’t be inherited. But that would be a breaking change that would require a major version change.

I’ll consider it for 5.0. 😄

1reaction
juanjoDiazcommented, Nov 29, 2020

Almost a year later but I’m looking back at this.

The issue seems to be in the serverless framework itself prioritizing includes over excludes… (see https://github.com/serverless/serverless/issues/8093)

For now the workaround is to force the exclusions but using includes like:

warmup:
  name: alexa-custom-warmup-${opt:stage, 'dev'}
  cleanFolder: true
  prewarm: true
  package:
    individually: true
    include:
      - !dist/index.js
      - _warmup/index.js

I’ll be releasing v5 at some point and making excluding the top level includes the default.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Serverless Plugin Warmup
WarmUp solves cold starts by creating a scheduled lambda (the warmer) that invokes all the selected service's lambdas in a configured time interval...
Read more >
Environment variables and app settings in Azure App Service
By default, it is master . WEBSITE_RUN_FROM_PACKAGE, Set to 1 to run the app from a local ZIP package, or set to the...
Read more >
Configuring Warmup Requests to Improve Performance
Enabling warmup requests​​ Warmup requests are used by the App Engine scheduler, which controls the auto scaling of instances based on user-supplied  ......
Read more >
Set the default instance warmup for an Auto Scaling group
You can use the default instance warmup to unify these settings at the group level. By default, these parameters will be set to...
Read more >
How do I get NuGet to install/update all the packages in ...
nuget install packages.config. Or with NuGet 2.7 you can restore all packages in the solution using the command line. nuget restore YourSolution.sln.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found