netlify / cli

Netlify Command Line Interface
http://cli.netlify.com
MIT License
1.58k stars 358 forks source link

Never says when finished reloading functions #627

Closed devuxer closed 4 years ago

devuxer commented 4 years ago

Minor user experience issue here:

When I change one of the files in my lambda folder, I see this:

◈ lambda\changed-file.js modified, reloading...

But there's no follow-up to indicate that it's finished reloading, making it seem like the reload has hung. If I test the endpoint, though, it has in fact reloaded.

Suggest putting something like this once it has reloaded:

◈ lambda\changed-file.js successfully reloaded!

superhawk610 commented 4 years ago

I've also noticed that function building fails silently. When I run netlify dev, I see this in the log

◈ Function builder netlify-lambda detected: Running npm script build:functions
 ›   Warning: ◈ This is a beta feature, please give us feedback on how to improve at https://github.com/netlify/cli/
◈ Function builder netlify-lambda building functions from ./lambda/functions

but the building fails and I just get 404 responses (since no actual built output is ever generated). If I run my function build command manually (yarn build:functions) I see the actual error

yarn run v1.22.4
$ netlify-lambda build ./lambda/functions
netlify-lambda: Building functions
Hash: 18f76027196bdc4076b9
Version: webpack 4.43.0
Time: 1664ms
Built at: 07/12/2020 7:49:40 PM
               Asset      Size  Chunks  Chunk Names
   create-session.js  87.5 KiB       0  create-session
finalize-checkout.js  86.8 KiB       1  finalize-checkout
Entrypoint create-session = create-session.js
Entrypoint finalize-checkout = finalize-checkout.js
 [0] /Users/aaronross/code/laurel/node_modules/stripe/lib/StripeResource.js 15.5 KiB {0} {1} [built]
 [1] external "stream" 42 bytes {0} {1} [built]
 [2] /Users/aaronross/code/laurel/node_modules/stripe/lib/utils.js 11.2 KiB {0} {1} [built]
 [3] external "zlib" 42 bytes {0} {1} [built]
 [4] external "url" 42 bytes {0} {1} [built]
 [5] ../shared/utils.js 117 bytes {0} {1} [built]
 [7] ../shared/middleware.js 857 bytes {0} {1} [built]
[10] ../models/customer.js 2.86 KiB {0} {1} [built] [failed] [1 error]
[13] ../models/Order.js 2.85 KiB {0} {1} [built] [failed] [1 error]
[14] ../shared/airtable.js + 10 modules 73 KiB {0} {1} [built]
     | ../shared/airtable.js 3.74 KiB [built]
     | /Users/aaronross/code/laurel/node_modules/node-fetch/lib/index.mjs 39.9 KiB [built]
     | /Users/aaronross/code/laurel/node_modules/wretch/dist/index.js 281 bytes [built]
     | /Users/aaronross/code/laurel/node_modules/nanoid/index.js 2.81 KiB [built]
     | /Users/aaronross/code/laurel/node_modules/wretch/dist/wretcher.js 14.6 KiB [built]
     | /Users/aaronross/code/laurel/node_modules/nanoid/url-alphabet/index.js 237 bytes [built]
     | /Users/aaronross/code/laurel/node_modules/wretch/dist/mix.js 1.48 KiB [built]
     | /Users/aaronross/code/laurel/node_modules/wretch/dist/config.js 1.33 KiB [built]
     | /Users/aaronross/code/laurel/node_modules/wretch/dist/resolver.js 6.41 KiB [built]
     | /Users/aaronross/code/laurel/node_modules/wretch/dist/perfs.js 1.78 KiB [built]
     | /Users/aaronross/code/laurel/node_modules/wretch/dist/middleware.js 452 bytes [built]
[21] ../shared/runner.js 809 bytes {0} {1} [built]
[22] /Users/aaronross/code/laurel/node_modules/stripe/lib/stripe.js 13.4 KiB {0} {1} [built]
[23] ../shared/stripe.js + 1 modules 1.19 KiB {0} {1} [built]
     | ../shared/stripe.js 1.07 KiB [built]
     | ../shared/constants.js 121 bytes [built]
[93] ./create-session.js 1.81 KiB {0} [built]
[94] ./finalize-checkout.js 641 bytes {1} [built]
    + 80 hidden modules

WARNING in ../shared/airtable.js 66:15-19
"export 'default' (imported as 'uuid') was not found in 'nanoid'
 @ ./finalize-checkout.js

ERROR in ../models/Order.js
Module build failed (from /Users/aaronross/code/laurel/node_modules/babel-loader/lib/index.js):
SyntaxError: /Users/aaronross/code/laurel/lambda/models/Order.js: super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class? (5:4)

  3 | export default class Order {
  4 |   constructor() {
> 5 |     super();
    |     ^
  6 |
  7 |     this.id = null;
  8 |     this.hash = null;
    at Parser._raise (/Users/aaronross/code/laurel/node_modules/@babel/parser/lib/index.js:757:17)
    at Parser.raiseWithData (/Users/aaronross/code/laurel/node_modules/@babel/parser/lib/index.js:750:17)
    at Parser.raise (/Users/aaronross/code/laurel/node_modules/@babel/parser/lib/index.js:744:17)
    at Parser.parseExprAtom (/Users/aaronross/code/laurel/node_modules/@babel/parser/lib/index.js:9924:16)
    at Parser.parseExprSubscripts (/Users/aaronross/code/laurel/node_modules/@babel/parser/lib/index.js:9688:23)
    at Parser.parseMaybeUnary (/Users/aaronross/code/laurel/node_modules/@babel/parser/lib/index.js:9668:21)
    at Parser.parseExprOps (/Users/aaronross/code/laurel/node_modules/@babel/parser/lib/index.js:9538:23)
    at Parser.parseMaybeConditional (/Users/aaronross/code/laurel/node_modules/@babel/parser/lib/index.js:9511:23)
    at Parser.parseMaybeAssign (/Users/aaronross/code/laurel/node_modules/@babel/parser/lib/index.js:9466:21)
    at Parser.parseExpression (/Users/aaronross/code/laurel/node_modules/@babel/parser/lib/index.js:9418:23)
    at Parser.parseStatementContent (/Users/aaronross/code/laurel/node_modules/@babel/parser/lib/index.js:11332:23)
    at Parser.parseStatement (/Users/aaronross/code/laurel/node_modules/@babel/parser/lib/index.js:11203:17)
    at Parser.parseBlockOrModuleBlockBody (/Users/aaronross/code/laurel/node_modules/@babel/parser/lib/index.js:11778:25)
    at Parser.parseBlockBody (/Users/aaronross/code/laurel/node_modules/@babel/parser/lib/index.js:11764:10)
    at Parser.parseBlock (/Users/aaronross/code/laurel/node_modules/@babel/parser/lib/index.js:11748:10)
    at Parser.parseFunctionBody (/Users/aaronross/code/laurel/node_modules/@babel/parser/lib/index.js:10751:24)
 @ ../shared/airtable.js 6:0-36 57:9-14 64:16-21
 @ ./finalize-checkout.js

These warnings/errors should be displayed in the netlify dev log as well IMO.

erezrokah commented 4 years ago

@superhawk610 see https://github.com/netlify/netlify-lambda/pull/239. For the CLI to properly report the errors we need netlify-lambda to exit with the relevant exit code first (assuming we don't want to report the entire stdout on each successful build).