netlify / create-react-app-lambda

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to start

peduarte opened this issue Β· comments

Hey πŸ‘‹

I'm not able to get this to run properly. The React App runs fine, but seems the netlify lambda is not working.

Steps to reproduce:

  1. Clone this repo
  2. Run yarn
  3. Run yarn start

When I do yarn start the CRA app launches. I click on the Call Lambda button and:
image

This is the error I get if I do yarn start:lambda directly:
image

I also tried running yarn build:lambda but get this:

ERROR in ./hello.js
Module build failed (from /Users/peduarte/Projects/playground/create-react-app-lambda/node_modules/babel-loader/lib/index.js):
Error: Cannot find module '@babel/plugin-transform-object-assign' from '/Users/peduarte/Projects/playground/create-react-app-lambda'

Could be related to this... dominictarr/event-stream#115 ? πŸ€”

Im not sure what's going on, would appreciate any guidance πŸ™

Thanks πŸ‘Š

πŸ™„Ermm, because of past negative experiences with Yarn, I decided to delete node_modules/ and yarn.lock and try it all again with npm.

  1. npm install
  2. npm start

And not it's all running as expected. So weird!

Would love it anyone could try and replicate this for me though.

thanks for the report! i cannot replicate this. using yarn works and clicking Call Lambda works as expected. what version of yarn are you using? i've got yarn 1.12.1 and node v10.13.0.

@sw-yx hey! I've got:

  • yarn - 1.3.2
  • node -10.10.0

I've upgraded yarn to 1.12.1 and I after running yarn I get this:
image

I've now upgraded node to 11.3.0 and I get the same error as above ☝️

Update
I deleted yarn.lock and ran yarn again and it now works! πŸ‘Œ

yea flatmap caused problems for me today too :( closing since it seems resolved.

Hey, weirdly enough it's all happening again 😒

~/Projects/playground/create-react-app-lambda master β˜‰
β–·  yarn start:lambda
yarn run v1.12.3
$ netlify-lambda serve src/lambda
netlify-lambda: Starting server
Lambda server is listening on 9000
Unhandled rejection Error: Cannot find module '/Users/peduarte/Projects/playground/create-react-app-lambda/lambda/hello'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
    at Function.resolve (internal/modules/cjs/helpers.js:32:19)
    at Object.clearCache (/Users/peduarte/Projects/playground/create-react-app-lambda/node_modules/netlify-lambda/lib/serve.js:111:36)
    at /Users/peduarte/Projects/playground/create-react-app-lambda/node_modules/netlify-lambda/bin/cmd.js:38:16
    at Array.forEach (<anonymous>)
    at Watching.handler (/Users/peduarte/Projects/playground/create-react-app-lambda/node_modules/netlify-lambda/bin/cmd.js:37:32)
    at compiler.hooks.done.callAsync (/Users/peduarte/Projects/playground/create-react-app-lambda/node_modules/netlify-lambda/node_modules/webpack/lib/Watching.js:98:9)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/peduarte/Projects/playground/create-react-app-lambda/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/Users/peduarte/Projects/playground/create-react-app-lambda/node_modules/tapable/lib/Hook.js:154:20)
    at Watching._done (/Users/peduarte/Projects/playground/create-react-app-lambda/node_modules/netlify-lambda/node_modules/webpack/lib/Watching.js:97:28)
    at onCompiled (/Users/peduarte/Projects/playground/create-react-app-lambda/node_modules/netlify-lambda/node_modules/webpack/lib/Watching.js:47:18)
    at hooks.afterCompile.callAsync.err (/Users/peduarte/Projects/playground/create-react-app-lambda/node_modules/netlify-lambda/node_modules/webpack/lib/Compiler.js:552:14)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/peduarte/Projects/playground/create-react-app-lambda/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/Users/peduarte/Projects/playground/create-react-app-lambda/node_modules/tapable/lib/Hook.js:154:20)
    at compilation.seal.err (/Users/peduarte/Projects/playground/create-react-app-lambda/node_modules/netlify-lambda/node_modules/webpack/lib/Compiler.js:549:30)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/peduarte/Projects/playground/create-react-app-lambda/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)

With node - v11.3.0 and yarn - 1.12.3.

It also doesn't seem to work with npm anymore:

~/Projects/playground/create-react-app-lambda master β˜‰
β–·  npm install
npm WARN deprecated kleur@2.0.2: Please upgrade to kleur@3 or migrate to 'ansi-colors' if you prefer the old syntax. Visit <https://github.com/lukeed/kleur/releases/tag/v3.0.0\> for migration path(s).

> fsevents@1.2.4 install /Users/peduarte/Projects/playground/create-react-app-lambda/node_modules/fsevents
> node install

node-pre-gyp WARN Tried to download(404): https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.2.4/fse-v1.2.4-node-v67-darwin-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for fsevents@1.2.4 and node@11.3.0 (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
In file included from ../fsevents.cc:6:
../../nan/nan.h:1064:44: warning: 'ToString' is deprecated: Use maybe version [-Wdeprecated-declarations]
      v8::Local<v8::String> string = from->ToString(v8::Isolate::GetCurrent());
                                           ^
/Users/peduarte/.node-gyp/11.3.0/include/node/v8.h:2537:3: note: 'ToString' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version",
  ^
/Users/peduarte/.node-gyp/11.3.0/include/node/v8config.h:326:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated(message)))
                            ^
../fsevents.cc:63:6: warning: field 'async_resource' will be initialized after field 'lockStarted' [-Wreorder]
   : async_resource("fsevents:FSEvents"), lockStarted(false) {
     ^
2 warnings generated.
  SOLINK_MODULE(target) Release/fse.node
  COPY /Users/peduarte/Projects/playground/create-react-app-lambda/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node
  TOUCH Release/obj.target/action_after_build.stamp

Oh man having so many issues with npm/yarn recently πŸ˜“

I'm surprised you can't replicate it though! Did you try removing node_modules and yarn.lock?

i didn't have to, i cloned this repo on a fresh machine and it "just worked".

leaving this open for now incase someone else can replicate

@sw-yx I see. You know what, I honestly don't think it's anything to do with this. I'm gonna continue to debug it and raise the issues with the corresponding libraries.

Thanks for this man! πŸ‘Š

i didn't have to, i cloned this repo on a fresh machine and it "just worked".

leaving this open for now incase someone else can replicate

I'm having this issue as well... so when you tried on a "fresh" (different?) machine, it worked? so it was just on the computer you were working on, you think?

@kmalillos feel free to open a new issue, i think this one getting a bit crowded.