Skip to content
This repository has been archived by the owner on Oct 17, 2019. It is now read-only.

npm run main fails. #48

Closed
gbasiemseverest opened this issue Jul 31, 2018 · 8 comments
Closed

npm run main fails. #48

gbasiemseverest opened this issue Jul 31, 2018 · 8 comments

Comments

@gbasiemseverest
Copy link

gbasiemseverest commented Jul 31, 2018

Thank you for sharing the amazing piece of your work,

I followed your well explained steps to reach here, but i couldn't npm run main to the backend.
I am continuously receiving the error,

TypeError: Cannot read property 'legs' of undefined

image

As suggested by few fellow programmers, i upgraded the npm version to 6.2 but still couldn't get any solution then i even downgraded to the version 4.6.1 still i am not getting anywhere.
Any help will be highly appreciated. Thank You

@monikagupta78
Copy link

I am also getting same error, were you able to fix this?

@domesticmouse
Copy link
Contributor

legs is supposed to be an attribute of the returned data, the fact that it is absent is indicative of there being no routes available. I should really add some error handling.

@monikagupta78
Copy link

@domesticmouse - does it mean we are good with backend setup? How to confirm the same?

@domesticmouse
Copy link
Contributor

Have you gone through the transport tracker codelabs?

@hynra
Copy link

hynra commented Aug 22, 2018

const ptt = this.directionsResponseForTrip(returnValue.next_trip.trip);

I faced same issue. If you print ptt, it's return message This API project is not authorized to use this API. I've resolved this issue by changing Maps API key in tracker_configuration.js from API Key to Server Key. I realized that The Getting Started (https://developers.google.com/maps/solutions/transport-tracker/start) is guide me to copy the API Key instead of Server Key.

@humbertn
Copy link

humbertn commented Sep 9, 2018

Hi @hynra where can I get the "Server Key" that you mention, thanks for you answer.

@Maphila
Copy link

Maphila commented Sep 10, 2018

@hynra The Server Key (from firebase) is giving out errors?

@mrsvt
Copy link

mrsvt commented Oct 7, 2018

The project uses Directions API. Enable the API, then it will work.

this.googleMapsClient
.directions(request)

Server Key is just a credential name generated by Google Service. For testing purposes, just ensure that the used API key doesn't have restrictions.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants