Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When mocking a function that has a JavaScript syntax error, nothing happens, endless wait #5159

Closed
berenddeboer opened this issue Aug 23, 2020 · 5 comments
Assignees
Labels
bug Something isn't working mock Issues tied to the mock functionality

Comments

@berenddeboer
Copy link

Describe the bug
Make a syntax error in your index.js. Then mock the function. Mock will hang until you press Ctrl+C.

Then you get the useless:

Starting execution...
^Cundefined:1



SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at ChildProcess.<anonymous> (/usr/lib/node_modules/@aws-amplify/cli/node_modules/amplify-nodejs-function-runtime-provider/lib/utils/invoke.js:45:37)
at ChildProcess.emit (events.js:315:20)
at ChildProcess.EventEmitter.emit (domain.js:483:12)
at maybeClose (internal/child_process.js:1021:16)
at Socket.<anonymous> (internal/child_process.js:443:11)
at Socket.emit (events.js:315:20)
at Socket.EventEmitter.emit (domain.js:483:12)
    at Pipe.<anonymous> (net.js:674:12)

A clear and concise description of what the bug is.

Amplify CLI Version
4.27.3

To Reproduce
Make a syntax error in your index.js. Then mock.

Expected behavior
The actual error returned by nodejs.

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
  • Node Version: 12.18.3
@berenddeboer
Copy link
Author

Might be fixed by #4978.

@UnleashedMind UnleashedMind added mock Issues tied to the mock functionality bug Something isn't working review labels Aug 24, 2020
@renebrandel renebrandel added this to Todo in Bug bash Aug 27, 2020
@edwardfoyle edwardfoyle moved this from Todo to In progress in Bug bash Aug 28, 2020
@edwardfoyle edwardfoyle self-assigned this Aug 28, 2020
@edwardfoyle edwardfoyle moved this from In progress to Review in Bug bash Aug 29, 2020
@devyzr
Copy link

devyzr commented Sep 4, 2020

Might be fixed by #4978.

It doesn't for me

@dmsolutionz
Copy link

Version 4.24.3 was the last known good version where even simple logging events worked properly, now mocking will force a hang, or give unusable logging / error messaging. Basically making our amplify project currently locked to 4.24.3...

@kaustavghosh06
Copy link
Contributor

We've fixed this issue as a part of #5198

Function mock improvements automation moved this from To do to Done Feb 5, 2021
@github-actions
Copy link

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working mock Issues tied to the mock functionality
Projects
Bug bash
  
Done
Development

No branches or pull requests

6 participants