yandex-cloud / nodejs-sdk

Yandex.Cloud NodeJS SDK
MIT License
64 stars 13 forks source link

Filter by function name does not work #10

Closed safer-bwd closed 4 years ago

safer-bwd commented 4 years ago

Filter by function name does not work in list() method.

nodejs: v10.16.1 yandex-cloud: v1.3.3

const { Session } = require('yandex-cloud');
const { FunctionService } = require('yandex-cloud/api/serverless/functions/v1');

const session = new Session({ iamToken: 'MY_TOKEN' });
const fs = new FunctionService(session);

(async () => {
  const { functions } = await fs.list({
    folderId: 'MY_FOLDER_ID',
    filter: `name=${MY_FUNCTION_NAME}` // does not throw an error without this string
  }); // throw an error
})();
{ Error: 13 INTERNAL: Internal
    at Object.exports.createStatusError (demo-yandex-sdk\node_modules\grpc\src\common.js:91:15)
    at Object.onReceiveStatus (demo-yandex-sdk\node_modules\grpc\src\client_interceptors.js:1209:28)
    at InterceptingListener._callNext (demo-yandex-sdk\node_modules\grpc\src\client_interceptors.js:568:42)
    at InterceptingListener.onReceiveStatus (demo-yandex-sdk\node_modules\grpc\src\client_interceptors.js:618:8)
    at callback (demo-yandex-sdk\node_modules\grpc\src\client_interceptors.js:847:24)
  code: 13,
  metadata: Metadata { _internal_repr: {}, flags: 0 },
  details: 'Internal' }
monsterzz commented 4 years ago

You should quote function name parameter (name='some'). We will improve our input validation to return more verbose error.

If this suggestion works for you, feel free to close an issue.

safer-bwd commented 4 years ago

Thanks. It works.