for "Streetcarts" demo project, batch scripts are failing

Hi,

for "Streetcarts" demo project, batch scripts are failing

Command used: node streetcarts-config-seed configure-baas ./streetcarts-config.json

Error thrown:

Creating collection: foodcarts
Creating collection: menus
Creating collection: items
Creating collection: reviews
Deleting role: owners
Deleting role: default
Deleting role: guest
Deleting group: owners
Deleting group: members
Request: DELETE https://apigee.com/purushuhns/sandbox/groups/owners?client_id=b3U6PN0W6iPUEeaqQ6lQ-kFmUg&client_secr...
undefined:1
SyntaxError: Unexpected end of input
at Object.parse (native)
at Request._callback (/home/ubuntu/workspace/streetcarts/proxies/src/gateway/bin/seed/apigee-app-config.js:531:32)
at Request.self.callback (/home/ubuntu/workspace/streetcarts/proxies/src/gateway/bin/seed/node_modules/request/request.js:187:22)
at emitTwo (events.js:87:13)
at Request.emit (events.js:172:7)
at Request.<anonymous> (/home/ubuntu/workspace/streetcarts/proxies/src/gateway/bin/seed/node_modules/request/request.js:1044:10)
at emitOne (events.js:77:13)
at Request.emit (events.js:169:7)
at IncomingMessage.<anonymous> (/home/ubuntu/workspace/streetcarts/proxies/src/gateway/bin/seed/node_modules/request/request.js:965:12)
at emitNone (events.js:72:20)
0 10 219
10 REPLIES 10

Also for

"Seeding the data store with a batch script"

Command used: node streetcarts-config-seed register-users ./streetcarts-config.json ./data/users.json

Exception thrown:

Creating user Liz456

Creating user steffen111

Creating user freewill444

Creating user jonesy42

Creating user Alex666

Creating user steve303

Request: POST https://purushuhns-test.apigee.net/v1/streetcarts/users

Headers: {"Content-Type":"application/json","x-api-key":"3l4THDAoLiPnJz3TAw4o3yiAhtXpzwvn"}

Status code: 500

Error creating user account:

Error: Script execution failed: Empty JSON string: SyntaxError: Empty JSON string

at /organization/environment/api/data-manager.js:2289

at /organization/environment/api/node_modules/request/request.js:187

at emit (events.js:98)

at /organization/environment/api/node_modules/request/request.js:1044

at emit (events.js:95)

at /organization/environment/api/node_modules/request/request.js:965

at emit (events.js:117)

at _stream_readable.js:943

at _tickDomainCallback (trireme.js:491)

at _tickFromSpinner (trireme.js:422)

Hey @Purushotham H Narayanswamy - The doc team will take a look and get back to you. Thanks.

Thanks Dino, i have now modified the configuration to reflect with api.usergrid.com.

And this resolved one of the issues during the script execution and failed at others.

command worked: node streetcarts-config-seed configure-baas ./streetcarts-config.json

command failed:

1) node streetcarts-config-seed register-users ./streetcarts-config.json ./data/users.json

Request: POST https://purushuhns-test.apigee.net/v1/streetcarts/users Headers: {"Content-Type":"application/json","x-api-key":"3l4THDAoLiPnJz3TAw4o3yiAhtXpzwvn"} Status code: 500 Error creating user account: Error: Script execution failed: Empty JSON string: SyntaxError: Empty JSON string at /organization/environment/api/data-manager.js:2289 at /organization/environment/api/node_modules/request/request.js:187 at emit (events.js:98) at /organization/environment/api/node_modules/request/request.js:1044 at emit (events.js:95) at /organization/environment/api/node_modules/request/request.js:965 at emit (events.js:117) at _stream_readable.js:943 at _tickDomainCallback (trireme.js:491) at _tickFromSpinner (trireme.js:422)

2)node streetcarts-config-seed create-foodcarts ./streetcarts-config.json ./data/combined-seed-data.json ./data/users.json

Creating foodcarts. Authenticating: Liz456 Authenticating: steffen111 Authenticating: freewill444 Authenticating: jonesy42 Authenticating: Alex666 Request: POST https://purushuhns-test.apigee.net/v1/streetcarts/accesstoken Headers: {"Content-Length":58,"Content-Type":"application/x-www-form-urlencoded","Authorization":"Basic M2w0VEhEQW9MaVBuSnozVEF3NG8zeWlBaHRYcHp3dm46ZmFoVzhvQWVJem5jb0dRTw==","x-api-key":"3l4THDAoLiPnJz3TAw4o3yiAhtXpzwvn"} Status code: 500 Error creating foodcart: Error: Execution of ServiceCallout Authenticate failed. Reason: ResponseCode 500 is treated as error

Dino,

Manual operations were done as per the troubleshooting page mentioned in "Deploying and Running" process:

1) created vault and added entries

2) created user data

Following steps were performed for troubleshooting the issue mentioned earlier

1) modified "remove api key" policy after "verify api key" policy in the Proxy Endpoints -> default -> Create User [Post Method] flow, query param had incorrect values.

2) added cors assign message policy for below GET methods after "validate admin tokey" policy

i) Proxy Endpoints -> default -> Get Users and

ii) Proxy Endpoints -> default -> Get Users By ID

facing with new error thrown during the command execution for adding foodcart data

command used:

node streetcarts-config-seed create-foodcarts ./streetcarts-config.json ./data/combined-seed-data.json ./data/users.json

Error thrown:

purushuhns:~/workspace/streetcarts/proxies/src/gateway/bin/seed (master) $ node streetcarts-config-seed create-foodcarts ./streetcarts-config.json ./data/combined-seed-data.json ./data/users.json

Creating foodcarts.

Authenticating: Liz456

Authenticating: steffen111

Authenticating: freewill444

Authenticating: jonesy42

Authenticating: Alex666

Request: POST https://nara-test.apigee.net/v1/streetcarts/accesstoken Headers: {"Content-Length":55,"Content-Type":"application/x-www-form-urlencoded","Authorization":"Basic cVozOFNuMEJhd25tNTFtWHZRcldCSmZpVFlrMWN6eUM6dlRJNUtJRHR4ZUxmVUVFWA==","x-api-key":"qZ38Sn0Bawnm51mXvQrWBJfiTYk1czyC"}

Status code: 401

Error creating foodcart:

Error: Permission denied.

Hi @Purushotham H Narayanswamy - I think you mean to refer to @Floyd Jones with your comments !

Hi Dino,

The last message was directed to you and not for Floyd. Please respond with any solution.

Regards,

Purushotham

Looping in @Steve Traut.

Hi @Purushotham H Narayanswamy,

Sorry you're running into this! I'll take a look. Are you using the scripts and data files from the github repo unmodified?

Thanks,

Steve

This url:

https://apigee.com/purushuhns/sandbox/groups/owners.

looks like it should be

https://api.usergrid.com/purushuhns/sandbox/groups/owners?

Is that part of your configuration? Can you check and verify the URL is correct in your configuration?

@Floyd Jones @Steve Traut FYI

Not applicable

Has this problem been resolved?

The following is the error I get when trying to get the streetcarts sample app running ...

node streetcarts-config-seed register-users ./data/users.json

prompt: Your Edge username: zabdsb@gmail.com

prompt: Your Edge password:

prompt: The Edge organization that hosts StreetCarts: zabdsb-trial

prompt: The environment the proxies are deployed to: (test)

prompt: The host part of the URL to your API proxies: (apigee.net)

prompt: The name of the StreetCarts app: (streetcarts)

prompt: Edge management API URL: (https://api.enterprise.apigee.com)

Getting app key and secret.

Got consumer key and secret

Request:

POST https://zabdsb-trial-test.apigee.net/v1/streetcarts/users

Headers:

{"Content-Type":"application/json","x-api-key":"cI8YPMbXVOqaDVvvB4ZAEGFMLCoGwP7t"}

Status code: 500

Error creating user account: Error: Script node executed prematurely: syntax error syntax error at module.js:439 at module.js:474 at module.js:356