box-node-sdk icon indicating copy to clipboard operation
box-node-sdk copied to clipboard

this.getEphemeralKeyInfo is not a function

Open engrpatel21 opened this issue 4 years ago • 1 comments

  • [x] I have checked that the SDK documentation doesn't solve my issue.
  • [x] I have checked that the API documentation doesn't solve my issue.
  • [x] I have searched the Box Developer Forums and my issue isn't already reported (or if it has been reported, I have attached a link to it, for reference).
  • [x] I have searched Issues in this repo and my issue isn't already reported.

Description of the Issue

when trying to make a client api call with client.get( 'search', params) i get a result of this.getEphemeralKeyInfo is not a function TypeError: this.getEphemeralKeyInfo is not a function

 boxConnection = new BoxSDKNode({
            clientID: this.configService.boxConfig.clientId,
            clientSecret: this.configService.boxConfig.clientSecret,
            proxy: {
                url: this.configService.boxConfig.httpProxy,
            },
        });
const boxToken = await axios.get<BoxAuthResponse>(this.configService.boxConfig.tokenUrl, boxRequestOptions);
const boxApi = boxConnection.getBasicClient(boxToken);

async getFileIds(folderId: string, filePrefix: string) {
        const boxApi = await getBoxApiConnection();
        const fileIds = await boxApi.get('search', {
            params: {
                ancestor_folder_ids: folderId,
                query: filePrefix,
            },
        });
        return fileIds;
        // return boxApi.search.query(filePrefix, {
        //     folderId: folderId,
        //     fields: 'id,name',
        //     type: 'file',
        //     file_extensions: 'csv,xlxs',
        // });
    }

when using boxApi.search.query() i get the expected response.

however with boxApi.get( 'search', params) i get this.getEphemeralKeyInfo is not a function TypeError: this.getEphemeralKeyInfo is not a function

ive tried to resolve this error without any luck.

Steps to Reproduce

see above functions to repoduce

Expected Behavior

get a response from the server instead of the error message.

Error Message, Including Stack Trace

Screenshots

 ERROR [ExceptionsHandler] this.getEphemeralKeyInfo is not a function
TypeError: this.getEphemeralKeyInfo is not a function
    at Object.onConnectSecure [as secure] (node:_tls_wrap:1521:25)
    at TransformOperationExecutor.transform (/home/fullmetal/dev/starfish/ui/node_modules/.pnpm/[email protected]/node_modules/src/TransformOperationExecutor.ts:190:37)
    at TransformOperationExecutor.transform (/home/fullmetal/dev/starfish/ui/node_modules/.pnpm/[email protected]/node_modules/src/TransformOperationExecutor.ts:307:31)
    at TransformOperationExecutor.transform (/home/fullmetal/dev/starfish/ui/node_modules/.pnpm/[email protected]/node_modules/src/TransformOperationExecutor.ts:307:31)
    at ClassTransformer.classToPlain (/home/fullmetal/dev/starfish/ui/node_modules/.pnpm/[email protected]/node_modules/src/ClassTransformer.ts:25:21)
    at Object.classToPlain (/home/fullmetal/dev/starfish/ui/node_modules/.pnpm/[email protected]/node_modules/src/index.ts:21:27)
    at ClassSerializerInterceptor.transformToPlain (/home/fullmetal/dev/starfish/ui/node_modules/.pnpm/@[email protected]_a468034557985838f227b3182a361474/node_modules/@nestjs/common/serializer/class-serializer.interceptor.js:47:32)
    at ClassSerializerInterceptor.serialize (/home/fullmetal/dev/starfish/ui/node_modules/.pnpm/@[email protected]_a468034557985838f227b3182a361474/node_modules/@nestjs/common/serializer/class-serializer.interceptor.js:43:20)
    at /home/fullmetal/dev/starfish/ui/node_modules/.pnpm/@[email protected]_a468034557985838f227b3182a361474/node_modules/@nestjs/common/serializer/class-serializer.interceptor.js:32:49
    at /home/fullmetal/dev/starfish/ui/node_modules/.pnpm/[email protected]/node_modules/rxjs/src/internal/operators/map.ts:56:33
    at OperatorSubscriber._this._next (/home/fullmetal/dev/starfish/ui/node_modules/.pnpm/[email protected]/node_modules/rxjs/src/internal/operators/OperatorSubscriber.ts:43:13)
    at OperatorSubscriber.Subscriber.next (/home/fullmetal/dev/starfish/ui/node_modules/.pnpm/[email protected]/node_modules/rxjs/src/internal/Subscriber.ts:75:12)
    at /home/fullmetal/dev/starfish/ui/node_modules/.pnpm/[email protected]/node_modules/rxjs/src/internal/operators/mergeInternals.ts:85:24
    at OperatorSubscriber._this._next (/home/fullmetal/dev/starfish/ui/node_modules/.pnpm/[email protected]/node_modules/rxjs/src/internal/operators/OperatorSubscriber.ts:43:13)
    at OperatorSubscriber.Subscriber.next (/home/fullmetal/dev/starfish/ui/node_modules/.pnpm/[email protected]/node_modules/rxjs/src/internal/Subscriber.ts:75:12)
    at /home/fullmetal/dev/starfish/ui/node_modules/.pnpm/[email protected]/node_modules/rxjs/src/internal/operators/switchMap.ts:112:42
::1 - - [14/Apr/2022:19:20:33 +0000] "GET /box-etl/file-ids?folder-id=160380083878&file-prefix=t HTTP/1.1" 500 52 "-" "PostmanRuntime/7.29.0"

Versions Used

Node SDK: Box Node.js SDK v2.1.0 (Node v17.4.0)

engrpatel21 avatar Apr 14 '22 19:04 engrpatel21

Hi @engrpatel21

Thanks for submitting this issue I will try to help you with it.

Unfortunately I was not able to reproduce this issue neither on windows nor macOS. Like you, I was testing it on Box Node.js SDK v2.1.0 with Node v17. Can you tell me what operating system you are using?

However, in your example, I found a typo when calling the boxApi.get() method. The first parameter which is the path should start with /, as this will be added to apiRootURL and apiVersion which defaults to https://api.box.com/2.0. in your case it should be /search instead of search. So please try again with this:

   const fileIds = await boxApi.get('/search', {
            params: {
                ancestor_folder_ids: folderId,
                query: filePrefix,
            },
        });

Please let me know about the result.

@arjankowski

arjankowski avatar Apr 19 '22 15:04 arjankowski

This issue has been automatically marked as stale because it has not been updated in the last 30 days. It will be closed if no further activity occurs within the next 7 days. Feel free to reach out or mention Box SDK team member for further help and resources if they are needed.

stale[bot] avatar Dec 19 '22 19:12 stale[bot]

This issue has been automatically closed due to maximum period of being stale. Thank you for your contribution to Box Node SDK and feel free to open another PR/issue at any time.

stale[bot] avatar Dec 26 '22 20:12 stale[bot]