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.

"Packaging: No files found" in deploy.

See original GitHub issue

I develop appsync by using serverless framework. I could deploy api successfully. Next I wanted to test it locally, so I introduced serverless-webpack, serverless-appsync-simulator, serverless-dynamodb-local and serverless-offline. I could test in local but couldn’t deploy with the following error. I comment outed serverless-webpack in serverless.yml. I could deploy successfully again. What should I do ?

error-log

$ serverless deploy -v --aws-profile private_name
Serverless: To ensure safe major version upgrades ensure "frameworkVersion" setting in service configuration (recommended setup: "frameworkVersion: ^2.48.0")

Serverless: Load command interactiveCli
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command config:tabcompletion
Serverless: Load command config:tabcompletion:install
Serverless: Load command config:tabcompletion:uninstall
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command upgrade
Serverless: Load command uninstall
Serverless: Load command delete-appsync
Serverless: Load command validate-schema
Serverless: Load command graphql-playground
Serverless: Load command deploy-appsync
Serverless: Load command update-appsync
Serverless: Load command webpack
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command generate-event
Serverless: Load command test
Serverless: Load command dashboard
Serverless: Load command output
Serverless: Load command output:get
Serverless: Load command output:list
Serverless: Load command param
Serverless: Load command param:get
Serverless: Load command param:list
Serverless: Load command studio
Serverless: Skipping variables resolution with old resolver (new resolver reported no more variables to resolve)
Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:cleanupTempDir
AppSync Plugin: GraphQl schema valid
Serverless: Invoke webpack:validate
Serverless: Using configuration:
{
  "includeModules": true,
  "webpackConfig": "webpack.config.js",
  "packager": "npm",
  "packagerOptions": {},
  "keepOutputDirectory": false,
  "concurrency": 8
}
Serverless: Removing /Users/name/Documents/git/Serverless/serverless-appsync-tutorial/.webpack
Serverless: Invoke webpack:compile
Serverless: Bundling with Webpack...
webpack compiled successfully in 38 ms
Serverless: Invoke webpack:package
Serverless: Fetch dependency graph from /Users/name/Documents/git/Serverless/serverless-appsync-tutorial/package.json
Serverless: Ignoring 1 NPM errors:
Serverless: => missing: serverless@^1.60.0 || 2, required by serverless-offline@7.0.0
Serverless: No external modules needed
 
 Serverless Error ----------------------------------------
 
  ServerlessError: Packaging: No files found
      at ServerlessWebpack.zip (/Users/name/Documents/git/Serverless/serverless-appsync-tutorial/node_modules/serverless-webpack/lib/packageModules.js:62:19)
      at /Users/name/Documents/git/Serverless/serverless-appsync-tutorial/node_modules/serverless-webpack/lib/packageModules.js:139:10
      at tryCatcher (/Users/name/Documents/git/Serverless/serverless-appsync-tutorial/node_modules/bluebird/js/release/util.js:16:23)
      at Object.gotValue (/Users/name/Documents/git/Serverless/serverless-appsync-tutorial/node_modules/bluebird/js/release/reduce.js:166:18)
      at Object.gotAccum (/Users/name/Documents/git/Serverless/serverless-appsync-tutorial/node_modules/bluebird/js/release/reduce.js:155:25)
      at Object.tryCatcher (/Users/name/Documents/git/Serverless/serverless-appsync-tutorial/node_modules/bluebird/js/release/util.js:16:23)
      at Promise._settlePromiseFromHandler (/Users/name/Documents/git/Serverless/serverless-appsync-tutorial/node_modules/bluebird/js/release/promise.js:547:31)
      at Promise._settlePromise (/Users/name/Documents/git/Serverless/serverless-appsync-tutorial/node_modules/bluebird/js/release/promise.js:604:18)
      at Promise._settlePromiseCtx (/Users/name/Documents/git/Serverless/serverless-appsync-tutorial/node_modules/bluebird/js/release/promise.js:641:10)
      at _drainQueueStep (/Users/name/Documents/git/Serverless/serverless-appsync-tutorial/node_modules/bluebird/js/release/async.js:97:12)
      at _drainQueue (/Users/name/Documents/git/Serverless/serverless-appsync-tutorial/node_modules/bluebird/js/release/async.js:86:9)
      at Async._drainQueues (/Users/name/Documents/git/Serverless/serverless-appsync-tutorial/node_modules/bluebird/js/release/async.js:102:5)
      at Immediate.Async.drainQueues [as _onImmediate] (/Users/name/Documents/git/Serverless/serverless-appsync-tutorial/node_modules/bluebird/js/release/async.js:15:14)
      at processImmediate (node:internal/timers:464:21)

serverless.yml

service: serverless-appsync-tutorial

provider:
  name: aws
  runtime: nodejs12.x
  stage: dev
  region: ap-northeast-2

plugins:
  - serverless-appsync-plugin
  - serverless-webpack
  - serverless-dynamodb-local
  - serverless-appsync-simulator
  - serverless-offline

custom:
  webpack:
    includeModules: true

  # some config

  dynamodb:
    stages:
      - dev
    start:
      port: 8000
      inMemory: true
      migrate: true
      seed: true
    seed:
      dev:
        sources:
          - table: UserTable
            sources: [./migrations/user.json]
          - table: ChatMessageTable
            sources: [./migrations/chatMessage.json]
  serverless-offline:
    useChildProcesses: true
    allowCache: true
  appsync-simulator:
    apiKey: da2-******

package.json

{
  "dependencies": {
    "serverless-appsync-plugin": "^1.11.3",
    "serverless-appsync-simulator": "^0.17.0",
    "serverless-dynamodb-local": "^0.2.39",
    "serverless-offline": "^7.0.0",
    "serverless-webpack": "^5.5.1",
    "webpack": "^5.40.0",
    "webpack-cli": "^4.7.2",
    "webpack-node-externals": "^3.0.0"
  }
}

webpack.config.js

const webpack = require("webpack");
const slsw = require("serverless-webpack");
const nodeExternals = require("webpack-node-externals");

module.exports = {
  entry: slsw.lib.entries,
  mode: slsw.lib.webpack.isLocal ? "development" : "production",
  target: "node",
  externals: [nodeExternals()],
  // plugins: [new webpack.IgnorePlugin({resourceRegExp: /^pg-native$/})],
};

My environment

Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              16.0.0
     Framework Version:         2.48.0
     Plugin Version:            5.4.1
     SDK Version:               4.2.3
     Components Version:        3.12.0

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
j0k3rcommented, Jun 23, 2021

Checking your serverless.yml file, you don’t have functions declared. Is it intended? I think that’s why serverless-webpack doesn’t find any files to package.

0reactions
ChrisLFieldsIIcommented, Jun 23, 2021

@j0k3r @yukitaka13-1110

Problem:

Checking your serverless.yml file, you don’t have functions declared. Is it intended? I think that’s why serverless-webpack doesn’t find any files to package.

I just ran into this issue myself and can confirm this is correct.

I created a serverless project with sls create -t aws-nodejs-typescript because I wanted typings for my config file.

I only needed to create a S3 resource so no functions were needed and I removed them from my config. Upon running sls deploy, I got the error Packaging: No files found in packageModules.js and then ended up here lol.

Here is an example repo I made to reproduce the error.

Solution:

I took your advice and just commented out the plugins variable of the serverless.ts and then ran sls deploy and all was good! When functions are needed, just uncomment.

TODOs:

Ultimately, this issue was caused by the sls create template assuming that users who choose the aws-nodejs-typescript are 100% going to include a function in their serverless.ts config.

I’m not for sure where or what the fix should be if any to prevent others from going on the hour goose-hunt I did lol.

My recommended fix would be that the generated aws-nodejs-typescript has a comment regarding this in the config file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deploy a package does not seem to work - Serverless Forums
Hi! I am using serverless package to create … well a package and try to deploy that later in a CI server. It...
Read more >
Serverless error - No file matches include / exclude patterns
I am trying some skeleton deployment using python.
Read more >
Packaging for windows fails "no files found to deploy" - Platform ...
When I try to package anything for windows, it fails with this error I'm just trying to package the template games, without changing...
Read more >
Troubleshoot deployment issues in Lambda
The Lambda runtime needs permission to read the files in your deployment package. You can use the chmod command to change the file...
Read more >
serverless-webpack - npm
If you do not enable individual packaging in your service (serverless.yml), the plugin creates one ZIP file for all functions (the service ...
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