Open yukitaka13-1110 opened 3 years ago
What version of serverless-webpack are you using?
Could you update line 62 of /Users/name/Documents/git/Serverless/serverless-appsync-tutorial/node_modules/serverless-webpack/lib/packageModules.js
with:
-const error = new this.serverless.classes.Error('Packaging: No files found');
+const error = new this.serverless.classes.Error('Packaging: No files found: ' + directory);
Try again and show me the new error message?
@j0k3r I use version 5.5.1.
{
"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"
}
}
@j0k3r I added directory output and get result.
No files found: /Users/name/Documents/git/Serverless/serverless-appsync-tutorial/.webpack/service
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.
@j0k3r Yeah I don't want to deploy functions. Only AppSync and DynamoDB. How can I make this happen?
@j0k3r At the moment I am using serverless-webpack for local testing.
I've never done that. But at least, I don't think you need serverless-webpack.
@j0k3r @yukitaka13-1110
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.
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.
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.
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
andserverless-offline
. I could test in local but couldn't deploy with the following error. I comment outedserverless-webpack
inserverless.yml
. I could deploy successfully again. What should I do ?error-log
serverless.yml
package.json
webpack.config.js
My environment