Test the Billing API


Link to chapter - https://serverless-stack.com/chapters/test-the-billing-api.html


Hi, i get the following when i run serverless invoke on the billing function:

Serverless Warning --------------------------------------
  A valid file to satisfy the declaration 'file(resources/api-gateway-errors.yml)' could not be found.
Serverless: Bundling with Webpack...
Time: 787ms
Built at: 2/14/2019 10:29:11 PM
         Asset      Size   Chunks             Chunk Names
    billing.js  8.72 KiB  billing  [emitted]  billing
billing.js.map  6.12 KiB  billing  [emitted]  billing
Entrypoint billing = billing.js billing.js.map
[./billing.js] 2.17 KiB {billing} [built]
[./libs/billing-lib.js] 285 bytes {billing} [built]
[./libs/response-lib.js] 762 bytes {billing} [built]
[babel-runtime/core-js/json/stringify] external "babel-runtime/core-js/json/stringify" 42 bytes {billing} [built]
[babel-runtime/helpers/asyncToGenerator] external "babel-runtime/helpers/asyncToGenerator" 42 bytes {billing} [built]
[babel-runtime/regenerator] external "babel-runtime/regenerator" 42 bytes {billing} [built]
[source-map-support/register] external "source-map-support/register" 42 bytes {billing} [built]
[stripe] external "stripe" 42 bytes {billing} [built]

I dont know why it isnt returning success code 200 or any failure code after function execution. Do you have any idea what i could be doing wrong?

Thank you


Not sure what is going on here. To debug this add a SLS_DEBUG=* server less invoke… before your command.


I had the same issue. When I cloned the repository for the project from git, it did not include the resource folder with the project. Therefore, that file did not exist. You can go to the git repo and copy the file contents, and create the file manually.

Also, the serverless.yml file did not include this section when the project was cloned:


  • ${file(resources/api-gateway-errors.yml)}


Yeah we missed that in one of our previous updates. It should be there now.