opentrace-community / opentrace-cloud-functions

OpenTrace Cloud Functions. Reference implementation of the BlueTrace protocol.
https://bluetrace.io
GNU General Public License v3.0
273 stars 121 forks source link

getEncryptionKeyTest { Error: 3 INVALID_ARGUMENT: Resource ID is not in a valid format #51

Closed supernovahimura closed 4 years ago

supernovahimura commented 4 years ago

config.ts

encryption

  ✓ should have a valid default algorithm
#encryption

getEncryptionSecret: Getting encryption key: 1) should succeed in getting encryption key

upload

  ✓ should have valid buckets (984ms)
#upload
  ✓ should use a good pin generator

3 passing (3s) 1 failing

1) config.ts

encryption

     should succeed in getting encryption key:
 Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (config.test.ts)

getEncryptionKeyTest { Error: 3 INVALID_ARGUMENT: Resource ID [projects/12312323131/secrets/B/ASDMALDSACNAKSCNASCNKASC/UI=/versions/1] is not in a valid format. at Object.callErrorFromStatus (opentrace-cloud-functions/functions/node_modules/@grpc/grpc-js/src/call.ts:79:24) at Http2CallStream.call.on (opentrace-cloud-functions/functions/node_modules/@grpc/grpc-js/src/client.ts:155:18) at Http2CallStream.emit (events.js:203:15) at process.nextTick (opentrace-cloud-functions/functions/node_modules/@grpc/grpc-js/src/call-stream.ts:186:14) at process._tickCallback (internal/process/next_tick.js:61:11) code: 3, details: 'Resource ID [projects/12312323131/secrets/B/ASDMALDSACNAKSCNASCNKASC/UI=/versions/1] is not in a valid format.', metadata: Metadata { internalRepr: Map { 'grpc-server-stats-bin' => [Array] }, options: {} }, note: 'Exception occurred in retry method that was not classified as transient' } npm ERR! Test failed. See above for more details.

alexissinglaire commented 4 years ago

@supernovahimura : Hi, looking at your log file there is something wrong with the encryption related.

Why there is /B/ prefix in the secret value definition? How you define the parameter "keyPath" in your /functions/src/config.ts file?

getEncryptionKeyTest { Error: 3 INVALID_ARGUMENT: Resource ID [projects/12312323131/secrets/B/ASDMALDSACNAKSCNASCNKASC/UI=/versions/1] is not in a valid format.

supernovahimura commented 4 years ago

@supernovahimura : Hola, mirando tu archivo de registro hay algo mal con el cifrado relacionado.

¿Por qué hay un prefijo / B / en la definición del valor secreto? ¿Cómo define el parámetro "keyPath" en su archivo /functions/src/config.ts?

getEncryptionKeyTest {Error: 3 INVALID_ARGUMENT: ID de recurso [projects / 12312323131 / secrets / B / ASDMALDSACNAKSCNASCNKASC / UI = / versiones / 1] no está en un formato válido.

as follows: keyPath: "B/ASDMALDSACNAKSCNASCNKASC/UI=" I get it with the following command head -c32 /dev/urandom | base64

alexissinglaire commented 4 years ago

@supernovahimura : After you generate the result from head command, use the random value generated as secret value inside the SECRET MANAGER API (if you're using the GCP).

And Inside the config.ts you should put the value of secret key name in the key path (not the secret value).

image

supernovahimura commented 4 years ago

Thanks @alexissinglaire.