remote method shell does not exist
no bin directory and this link is broken: https://github.com/strongloop/loopback-example-app-logic/blob/master/bin/remote-method-request
The bin directory doesn't exist because you create it yourself (the step tells you to do it via mkdir bin). I removed the broken link to make things less confusing. ;) Thanks for the report!
Hi Simon,
The link is still broken “Create a bin directoryhttps://github.com/strongloop/loopback-example-app-logic/blob/master/bin to store scripts.”
And I am executing tutorials on windows – and can’t follow these steps: In this directory, create an executable shell script named remote-method-request. Remember to set execute permissions on the script to run it (ie. chmod a+x ./bin/remote-method-request
Radu
From: Simon Ho [mailto:[email protected]] Sent: Monday, March 02, 2015 1:23 PM To: strongloop/loopback-example-app-logic Cc: Marian, Radu Subject: Re: [loopback-example-app-logic] remote method shell does not exist (#4)
The bin directory doesn't exist because you create it yourself (the step tells you to do it via mkdir bin). I removed the broken link to make things less confusing. ;) Thanks for the report!
— Reply to this email directly or view it on GitHubhttps://github.com/strongloop/loopback-example-app-logic/issues/4#issuecomment-76768970.
This message, and any attachments, is for the intended recipient(s) only, may contain information that is privileged, confidential and/or proprietary and subject to important terms and conditions available at http://www.bankofamerica.com/emaildisclaimer. If you are not the intended recipient, please delete this message.
The script doesn't do anything fancy in particular, it simply makes a CURL request to the API endpoint you defined. I will have to change that step in an update to curl -XPOST localhost:3000/api/cars/rev-engine -d {"sound":"vroom"}.
Makes sense, Thank you!
This message, and any attachments, is for the intended recipient(s) only, may contain information that is privileged, confidential and/or proprietary and subject to important terms and conditions available at http://www.bankofamerica.com/emaildisclaimer. If you are not the intended recipient, please delete this message.
Would you like to submit a PR with a fix? Let me know if the above works.
I updated the readme.
I have tried the above and getting:
c:\curl-7.16.4>curl localhost:3000/api/cars/rev-engine -d '{"sound":"vroom"}' {"engineSound":"undefined undefined undefined"}
This message, and any attachments, is for the intended recipient(s) only, may contain information that is privileged, confidential and/or proprietary and subject to important terms and conditions available at http://www.bankofamerica.com/emaildisclaimer. If you are not the intended recipient, please delete this message.
And this one: curl -XPOST localhost:3000/api/cars -d {"sound":"vroom"} produces: {"id":1,"{sound:vroom}":""}
This message, and any attachments, is for the intended recipient(s) only, may contain information that is privileged, confidential and/or proprietary and subject to important terms and conditions available at http://www.bankofamerica.com/emaildisclaimer. If you are not the intended recipient, please delete this message.
It looks like a bug, I've created an issue you can track.
Connected to https://github.com/strongloop/loopback/issues/1168
The issue has been fixed in https://github.com/strongloop/loopback-example-app-logic/pull/5
tldr
curl -XPOST localhost:3000/api/cars/rev-engine -H "content-type:application/json" -d '{"sound":"vroom"}'
Do I need to re-do the steps? The following command: curl -XPOST localhost:3000/api/cars/rev-engine -H "content-type:application/json" -d '{"sound":"vroom"}'
produces this error:
{"error":{"name":"SyntaxError","status":400,"message":"Unexpected token '","body":"'{sound:vroom}'","stack":"SyntaxError
: Unexpected token '\n at Object.parse (native)\n at parse (c:\Projects\StrongLoop\loopback-example-app-logic
node_modules\loopback\node_modules\body-parser\lib\types\json.js:68:17)\n at c:\Projects\StrongLoop\loopback
-example-app-logic\node_modules\loopback\node_modules\body-parser\lib\read.js:91:18\n at IncomingMessage.onEnd
(c:\Projects\StrongLoop\loopback-example-app-logic\node_modules\loopback\node_modules\body-parser\node_modules
raw-body\index.js:136:7)\n at IncomingMessage.g (events.js:180:16)\n at IncomingMessage.
.
This message, and any attachments, is for the intended recipient(s) only, may contain information that is privileged, confidential and/or proprietary and subject to important terms and conditions available at http://www.bankofamerica.com/emaildisclaimer. If you are not the intended recipient, please delete this message.
Try recloning this repo as a fresh project, npm install, slc run and then curl -XPOST localhost:3000/api/cars/rev-engine -H 'content-type:application/json' -d '{"sound":"vroom"}'.
Just did that – same syntaxerror 400
On the sever side I get: Web server listening at: http://localhost:3000/ loopback deprecated Routes "/methods" and "/models" are considered dangerous and should not be used. Disable them by setting "legacyExplorer=false" in "server/config.json" or via "app.set()". node_modules\loopback\node_mo dules\express\lib\router\layer.js:82:5
also “slc run” should be performed before curl
I suggest a thorough test – before releasing the tutorial
This message, and any attachments, is for the intended recipient(s) only, may contain information that is privileged, confidential and/or proprietary and subject to important terms and conditions available at http://www.bankofamerica.com/emaildisclaimer. If you are not the intended recipient, please delete this message.
also “slc run” should be performed before curl
Step 3 states:
Test it by starting the server and running curl -XPOST localhost:3000/api/cars/rev-engine -H "content-type:application/json" -d '{"sound":"vroom"}'.
"starting the server" in this case IS slc run (or node . or node server/server).
On the sever side I get: Web server listening at: http://localhost:3000/ loopback deprecated Routes "/methods" and "/models" are considered dangerous and should not be used. Disable them by setting "legacyExplorer=false" in "server/config.json" or via "app.set()". node_modules\loopback\node_mo dules\express\lib\router\layer.js:82:5
As for the error message, you can fix it by adding "legacyExplorer": false to server/config.json:
...
"errorHandler": {
"disableStackTrace": false
},
"legacyExplorer": false
}
You can follow this issue to find out why the error shows up. tl;dr: An update is in the works to add the option by default (meaning the message will go away once that issue is merged).
I suggest a thorough test – before releasing the tutorial
This repository was thoroughly tested months ago, but LoopBack has been updated many times since then. Inevitably, this means every example starts going out of date as soon as we release it. So in general, we fix examples when users report issues in order to leverage support from community.
That said, it seems this is a windows issue (because cloning the repo and copy/pasting the curl command works fine on my machine running OSX). What version of Windows are you using?
@cgole Do you have a windows machine available? I would like to reproduce this issue, which would require four steps:
git clone https://github.com/strongloop/loopback-example-app-logicnpm installslc runcurl -XPOST localhost:3000/api/cars/rev-engine -H 'content-type:application/json' -d '{"sound":"vroom"}'
On the server side, you should see something like:
Request tracking middleware triggered on /api/cars/rev-engine.
Putting in the car key, starting the engine.
Turning off the engine, removing the key.
The request processing time is 28.747584999999997 ms.
On the client response, you should see:
{"engineSound":"vroom vroom vroom"}
· Yes – I am always running “slc run” before issue curl – just pointed this out for the sake of tutorial completeness.
· I understand the challenge of “every example starts going out of date as soon as we release it “ – would tutorial automated testing help?
· Running on Windows 7 with 64 bit.
After making the config.js change and running slc run. I am getting Server side: c:\Projects\StrongLoop\loopback-example-app-logic>slc run INFO strong-agent API key not found, StrongOps dashboard reporting disabled. Generate configuration with: npm install -g strongloop slc strongops See http://docs.strongloop.com/strong-agent for more information. supervisor running without clustering (unsupervised) Browse your REST API at http://localhost:3000/explorer Web server listening at: http://localhost:3000/
Client side: c:\curl-7.16.4>curl localhost:3000/api/cars/rev-engine -H 'content-type:application/json' -d '{"sound":"vroom"} {"engineSound":"undefined undefined undefined"}
This message, and any attachments, is for the intended recipient(s) only, may contain information that is privileged, confidential and/or proprietary and subject to important terms and conditions available at http://www.bankofamerica.com/emaildisclaimer. If you are not the intended recipient, please delete this message.
· Yes – I am always running “slc run” before issue curl – just pointed this out for the sake of tutorial completeness.
How would you like the readme improved? Would it help if I changed the wording to "Test it by starting the server (via slc run) and running ...".
· I understand the challenge of “every example starts going out of date as soon as we release it “ – would tutorial automated testing help?
I actually agree with this approach, but we do not have the resources to go through all the examples automate them all at this time. I do know that we have some automation being put in place for smoke tests to ensure things at least work at a minimum. I'm sure @altsang can chime in here with regards to our future plans related to maintaining examples.
After making the config.js change and running slc run. I am getting...
I'm glad the error is gone. The team has a fix in the works to make it so you don't have to do this manually in the future.
Finally, I've reproduced the issue on windows (thanks for the VM @cgole). The answer is single quotes are different on Unix/Linux machines. This means curl is getting confused because single quotes in cmd are represented as backticks. Try this:
curl -XPOST localhost:3000/api/cars/rev-engine -h "content-type:application/json" -d "{\"sound\":\"vroom\"}"
tl;dr
You have to use escaped double quotes for the curl command on windows.
I will update the readme and make notes for Windows users for future reference. Please let me know if this this works for you. ;)
I also added the bin directory scripts back since they were missing: https://github.com/strongloop/loopback-example-app-logic/tree/master/bin
Yes – that fixed windows/curl issues – thank you!
This message, and any attachments, is for the intended recipient(s) only, may contain information that is privileged, confidential and/or proprietary and subject to important terms and conditions available at http://www.bankofamerica.com/emaildisclaimer. If you are not the intended recipient, please delete this message.
NP, thanks for your patience.
@superkhau
Hi, after adding "legacyExplorer": false to server/config.json I'm still getting this warning:
{
"errorHandler": {
"disableStackTrace": false
},
"legacyExplorer": false
}
}
loopback deprecated Routes "/methods" and "/models" are considered dangerous and should not be used. Disable them by setting "legacyExplorer=false" in "server/config.json" or via "app.set()".
What is this about? Which routes are still enabled?
What does this document statement mean:
Set to false to disable old routes /models and /routes that are exposed, but no longer used by API Explorer; use true or omit the option keep them enabled.