googlemaps / googlemaps/google-maps-services-js
client.reverseGeocode throws TypeError: this.getEphemeralKeyInfo is not a function
- Dominant language
- TypeScript
- Stars
- 3.1k
- Forks
- 654
- Avg merge
- 3m
- Merged PRs (30d)
- 4
Description
Im unable to use the Client.reverseGeocode correctly, I've juggled around with the request object's preperties to no result =(.
I'm using the library within a NestJs server. Judging by the error log, since the exception is thrown within the google maps package, i'm confident its an issue with the library, perhaps im wrong?...
heres the code
```
import { Client, Language} from "@googlemaps/google-maps-services-js";
import { Injectable } from '@nestjs/common';
@Injectable()
class GoogleApiService {
constructor(private readonly client: Client) {}
async autocompletePlaces(text: string, lat: number, lng: number) {
this.client.autocomplete(/* works!! */)
}
async geocode(place: string) {
this.client.geocode(/* works!! */)
}
async reverseGeocode(lat: number, lng: number) {
return this.client.reverseGeocode({
params: {
language: Language.es,
latlng: { lat, lng },
key: process.env.GOOGLE_API_KEY,
},
method: 'GET'
})
}
}
}
```
and this is the error log, i've put this arrows "--->" in lines i deemed important
```
ERROR [ExceptionsHandler] this.getEphemeralKeyInfo is not a function
--->TypeError: this.getEphemeralKeyInfo is not a function
at Object.onConnectSecure [as secure] (node:_tls_wrap:1523:25)
at TransformOperationExecutor.transform (C:\Users\marco\Desktop\nest-sagi-app\node_modules\src\TransformOperationExecutor.ts:207:39)
at TransformOperationExecutor.transform (C:\Users\marco\Desktop\nest-sagi-app\node_modules\src\TransformOperationExecutor.ts:327:31)
at C:\Users\marco\Desktop\nest-sagi-app\node_modules\src\TransformOperationExecutor.ts:79:30
at Array.forEach ()
at TransformOperationExecutor.transform (C:\Users\marco\Desktop\nest-sagi-app\node_modules\src\TransformOperationExecutor.ts:44:24)
at TransformOperationExecutor.transform (C:\Users\marco\Desktop\nest-sagi-app\node_modules\src\TransformOperationExecutor.ts:327:31)
at TransformOperationExecutor.transform (C:\Users\marco\Desktop\nest-sagi-app\node_modules\src\TransformOperationExecutor.ts:327:31)
at TransformOperationExecutor.transform (C:\Users\marco\Desktop\nest-sagi-app\node_modules\src\TransformOperationExecutor.ts:327:31)
at TransformOperationExecutor.transform (C:\Users\marco\Desktop\nest-sagi-app\node_modules\src\TransformOperationExecutor.ts:327:31)
---> C:\Users\marco\Desktop\nest-sagi-app\node_modules\@googlemaps\google-maps-services-js\node_modules\axios\lib\adapters\http.js:70
--->var data = config.data;
^
--->TypeError: Cannot read properties of undefined (reading 'data')
--->at dispatchHttpRequest (C:\Users\marco\Desktop\nest-sagi-app\node_modules\@googlemaps\google-maps-services-js\node_modules\axios\lib\adapters\http.js:70:23)
at new Promise ()
at Object.httpAdapter [as adapter] (C:\Users\marco\Desktop\nest-sagi-app\node_modules\@googlemaps\google-maps-services-js\node_modules\axios\lib\adapters\http.js:49:10)
at C:\Users\marco\Desktop\nest-sagi-app\node_modules\@googlemaps\google-maps-services-js\src\adapter.ts:56:8
at new Promise ()
at Object.customAdapter [as adapter] (C:\Users\marco\Desktop\nest-sagi-app\node_modules\@googlemaps\google-maps-services-js\src\adapter.ts:54:3)
at TransformOperationExecutor.transform (C:\Users\marco\Desktop\nest-sagi-app\node_modules\src\TransformOperationExecutor.ts:207: at TransformOperationExecutor.transform (C:\Users\marco\Desktop\nest-sagi-app\node_modules\src\TransformOperationExecutor.ts:327:31) at ClassTransformer.instanceToPlain (C:\Users\marco\Desktop\nest-sagi-app\node_modules\src\ClassTransformer.ts:25:21)
at Object.classToPlain (C:\Users\marco\Desktop\nest-sagi-app\node_modules\src\index.ts:23:27)
```
im working with
```
"@googlemaps/google-maps-services-js": "^3.3.16",
```
i really apreciate any help i cant get
Contributor guide
Assessment
This issue has not been assessed yet.