streetcarts: 500 error adding users; script streetcarts-config-seed

samuelucich
Participant IV

This script seems to connect and start to create users, but then crashes with a 500 error when it tries to Post:

[root@localhost seed]# node streetcarts-config-seed register-users ./data/users.json

sleep: using busy loop fallback

prompt: Your Edge username: samuelucich@gmail.com

prompt: Your Edge password:

prompt: The Edge organization that hosts StreetCarts: samuelucich-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

Creating user Liz456

Creating user steffen111

Creating user freewill444

Creating user jonesy42

Creating user Alex666

Creating user steve303

Request: POST https://samuelucich-trial-test.apigee.net/v1/streetcarts/users Headers: {"Content-Type":"application/json","x-api-key":"0IHOGzzNqURdihUFl6H6wnxYIdqHqn6g"}

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

at module.js:312

at module.js:364

at require (module.js:380)

at /organization/environment/api/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js:5

at module.js:456

at module.js:474

at module.js:356

at module.js:312

at module.js:364

at require (module.js:380)

at /organization/environment/api/node_modules/request/node_modules/hawk/lib/index.js:5 at module.js:456

at module.js:474

at module.js:356

at module.js:312

at module.js:364

at require (module.js:380) at /organization/environment/api/node_modules/request/request.js:9

at module.js:456

at module.js:474

at module.js:356

at module.js:312

at module.js:364 at require (module.js:380)

at /organization/environment/api/node_modules/request/index.js:143

at module.js:456

at module.js:474

at module.js:356

at module.js:312

at module.js:364

at require (module.js:380) at /organization/environment/api/data-manager.js:1 at module.js:456

at module.js:474

at module.js:356

at module.js:312

at module.js:364

at require (module.js:380) at /organization/environment/api/server.js:7

at module.js:456

at module.js:474

at module.js:356

at module.js:312

at module.js:497

0 7 95
7 REPLIES 7

samuelucich
Participant IV

Did a Trace on this proxy, seems the frontend processes the request OK, but then the backend is called 'datamanager' and gets an error i the User_REQEST_FLOW...how do you fix something like this?

5767-error.png

We'll look into this and get back to you, @samuel ucich. Apologies for the hassle.

Hi Floyd,

Did your team have a chance to look at this? I'll try again to see if anything as changed.

Thanks, Sam

FYI - i re-ran the script, trying again to register users, and it failed with the same error...

Hi Again,

I tried to push on, so i created a user manually on the BaaS pages: Liz456. But one thing that doesn't line up is, when you create a user on BaaS, the form does not have a 'firstname' and a 'lastname' field...it has a 'full name' field. The json data has firstname/lastname:

"firstName": "Liz",

"lastName": "Lynch",

"address": "Ap #614-3294 Arcu Street",

"city": "Grand Island",

"region": "NE",

"postalCode": "69010",

"email": "lizzie@example.com",

"username": "Liz456",

"password": "Password1"

It feels like these scripts are not in alignment with BaaS? I'm trying to learn Apigee Edge and this 'seemed' like a good exercise, but maybe not!!?? Is BaaS fairly new?

If you know of other exercises that teach you about building proxies with BaaS...And they actually work, please let me know.

Thanks, Sam

Sorry for the delay, @samuel ucich. Will loop in @Steve Traut to see if we can figure this out.

Hi @samuel ucich --

I've been looking into this issue today and I'm seeing exactly the same thing you are -- a "syntax error" that seems related to one of the modules supporting the request module. In the StreetCarts code, the issue reaches from the request module "require" statement back through several lines of code supporting the module. None of this seems tied to StreetCarts code that actually does anything other than require the module, suggesting that the problem isn't StreetCarts, but rather some bug further back. That's my working theory. I'm still looking at it.

Others who've had a problem similar to this one have discovered a syntax error in their own code, even in JSON. I'm not seeing that (though of course that doesn't mean it's not there).

As for the fields you noticed in the BaaS UI, they're merely a suggestion. API BaaS is backed by a "no-SQL" data store that is not schema driven. In fact, you could put almost any set of fields at all into an entity in the User collection and your data would be "valid". StreetCarts uses firstname/lastname fields because it seemed likely that an app builder would, in theory, want to refer to their user by first name only at times. You can add these fields with the API BaaS API (which is what StreetCarts is designed to do).

For other resources through which you can learn about proxy-building, be sure to the see the docs. In particular, you might try out one of our tutorials.

My apologies for all the trouble you're having. Having been there much of today, I can understand how frustrating it must be. We'll do our best to get it resolved.

Steve