google cloud secret manager nodejs getsecret problem - google-cloud-run

I need to get a password from Google Secret Manager in my Cloudrun application.
My code:
const {SecretManagerServiceClient} = require('#google-cloud/secret-manager');
const smClient = new SecretManagerServiceClient();
const pgpwd = 'projects/xxxxxxxx/secrets/pgpwd';
async function getSecret() {
const [version] = await smClient.accessSecretVersion({
pgpwd: pgpwd
});
const pwd = version.payload.data.toString();
return pwd;
}
const pwd = getSecret();
console.log(`out secret ${pwd}`);
Recieve during deployment...
020-09-18 11:55:12.421 IDT> node index.js
2020-09-18 11:55:12.421 IDT
2020-09-18 11:55:14.061 IDTout secret [object Promise]
2020-09-18 11:55:14.062 IDTServer running on port 8080
2020-09-18 11:55:15.451 IDT(node:14) UnhandledPromiseRejectionWarning: Error: 3 INVALID_ARGUMENT: Invalid resource field value in the request.
2020-09-18 11:55:15.451 IDT at Object.callErrorFromStatus (/usr/src/app/node_modules/#grpc/grpc-js/build/src/call.js:31:26)
2020-09-18 11:55:15.451 IDT at Object.onReceiveStatus (/usr/src/app/node_modules/#grpc/grpc-js/build/src/client.js:176:52)
2020-09-18 11:55:15.451 IDT at Object.onReceiveStatus (/usr/src/app/node_modules/#grpc/grpc-js/build/src/client-interceptors.js:342:141)
2020-09-18 11:55:15.451 IDT at Object.onReceiveStatus (/usr/src/app/node_modules/#grpc/grpc-js/build/src/client-interceptors.js:305:181)
2020-09-18 11:55:15.451 IDT at /usr/src/app/node_modules/#grpc/grpc-js/build/src/call-stream.js:124:78
2020-09-18 11:55:15.451 IDT at processTicksAndRejections (internal/process/task_queues.js:79:11)
2020-09-18 11:55:15.451 IDT(node:14) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
2020-09-18 11:55:15.551 IDT(node:14) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

const [version] = await smClient.accessSecretVersion({
pgpwd: pgpwd
});
should be:
const [version] = await smClient.accessSecretVersion({
name: pgpwd
});
and pgpwd should be of the format:
projects/PROJECT/secrets/NAME/versions/VERSION
You can use a version number or the magic alias “latest” to fetch the most recent.

Related

iOS script is not running on Appium

When I'm trying to run iOS scripts the Appium server is running but just shows listener started on 0.0.0.0:4723. I don't know where the error is ?
Appium: Server is not running
AlexHacki- Downloads % appium --base-path /wd/hub
[Appium] Welcome to Appium v1.23.0
[Appium] Appium REST http interface listener started on 0.0.0.0:4723.
Capabilities for iOS
capabilities: {
platformName: 'iOS',
deviceName: 'iPhone',
app: '/Users/Documents/iOSTest.ipa',
automationName: 'XCUITest',
platformVersion: '15.4',
noReset: true,
formFactor: 'MOBILE'
},
Error: After running the script
022-06-09T07:00:00.296Z INFO #wdio/local-runner: Run worker command: run
2022-06-09T07:00:00.607Z DEBUG #wdio/config:utils: Found 'ts-node' package, auto-compiling TypeScript files
2022-06-09T07:00:00.979Z DEBUG #wdio/local-runner:utils: init multiremote session
2022-06-09T07:00:00.984Z ERROR #wdio/runner: Error: Required option "capabilities" is missing
at validateConfig (/Users/alex/Documents//__tests__/appium/node_modules/#wdio/config/build/utils.js:53:19)
at remote (/Users/alex/Documents/node_modules/webdriverio/build/index.js:58:48)
at /Users/alex/Documents/webdriverio/build/index.js:139:51
at Array.map (<anonymous>)
at multiremote (/Users/alex/Documents/node_modules//webdriverio/build/index.js:138:36)
at initialiseInstance (/Users/alex/Documents/node_modules/#wdio/runner/build/utils.js:73:57)
at Runner._startSession (/Users/alex/Documents/appium/node_modules/#wdio/runner/build/index.js:223:93)
at Runner._initSession (/Users/alex/Documents/appium/node_modules/#wdio/runner/build/index.js:176:36)
at Runner.run (/Users/alex/Documents/appium/node_modules/#wdio/runner/build/index.js:88:30)
2022-06-09T07:00:13.403Z DEBUG #wdio/local-runner: Runner 0-0 finished with exit code 1
[ FAILED in /Users/alex/Documents/iOSTest.ipa - /test/specs/smoke/guide.test.js
2022-06-09T07:00:13.403Z INFO #wdio/cli:launcher: Run onWorkerEnd hook
2022-06-09T07:00:13.404Z DEBUG #wdio/cli:utils: Finished to run "onWorkerEnd" hook in 0ms
2022-06-09T07:00:13.404Z INFO #wdio/cli:launcher: Run onComplete hook
Can't generate report portal launch url
Error: Request failed with status code 401:
at /Users/alex/Documents/appium/node_modules/reportportal-js-client/lib/rest.js:33:23
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Function.getLaunchUrlByParams (/Users/alex/Documents/appium/node_modules/wdio-reportportal-service/src/index.js:108:20)
at async Function.getLaunchUrl (/Users/alex/Documents/node_modules/wdio-reportportal-service/src/index.js:92:12)
at async Object.onComplete (/Users/alex/Documents/appium/conf/shared.conf.js:60:18)
at async /Users/alex/Documents/node_modules/#wdio/cli/build/utils.js:96:13
at async Promise.all (index 0)
at async Launcher.run (/Users/alex/Documents/__tests__/appium/node_modules/#wdio/cli/build/launcher.js:96:39)
Report portal link undefined
at /Users/alex/Documents/__tests__/appium/node_modules/reportportal-js-client/lib/rest.js:33:23
at processTicksAndRejections (internal/process/task_queues.js:95:5)
Error: Request failed with status code 401:
at /Users/alex/Documents/node_modules/reportportal-js-client/lib/rest.js:33:23
at processTicksAndRejections (internal/process/task_queues.js:95:5)
2022-06-09T07:00:14.462Z DEBUG #wdio/cli:utils: Finished to run "onComplete" hook in 603ms

When Apple test my macOS app they don't get permission to open a local Webbserver

I have created a macOS app with Electron.
The app runs without any problem if I build it and run it locally.
But when Apple tries to run they encounter a problem that gives them this error.
[2021-06-09 10:59:19.217] [info] ----------> start_server
[2021-06-09 10:59:19.218] [info] 3000
[2021-06-09 10:59:19.221] [info] Error while starting server: listen EPERM: operation not permitted 0.0.0.0:3000
[2021-06-09 10:59:19.222] [info] Error caught: listen EPERM: operation not permitted 0.0.0.0:3000
[2021-06-09 10:59:19.222] [info] Error stack : Error: listen EPERM: operation not permitted 0.0.0.0:3000
I'm trying to start a http server with this code:
module.exports = {
startServer: async () => {
_port = await UtilityService.getPort();
console.log(_port);
return new Promise((resolve, reject) => {
httpServer.on('error', error => {
console.log('Error while starting server: ', error.message);
onError(error);
reject(error);
});
httpServer.listen(_port, () => {
console.log('HTTP Server listening on http://localhost:' + _port + '/');
resolve();
});
})
},
https://github.com/mattehalen/Scheduled-countdown/blob/master/src/server.js

Nebula Graph fails on CentOS 6.5

Nebula Graph fails on CentOS 6.5, the error message is as follows:
# storage log
Heartbeat failed, status:RPC failure in MetaClient: N6apache6thrift9transport19TTransportExceptionE: AsyncSocketException: connect failed, type = Socket not open, errno = 111 (Connection refused): Connection refused
# meta log
Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
E0415 22:32:38.944437 15532 AsyncServerSocket.cpp:762] failed to set SO_REUSEPORT on async server socket Protocol not available
E0415 22:32:38.945001 15510 ThriftServer.cpp:440] Got an exception while setting up the server: 92failed to bind to async server socket: [::]:0: Protocol not available
E0415 22:32:38.945057 15510 RaftexService.cpp:90] Setup the Raftex Service failed, error: 92failed to bind to async server socket: [::]:0: Protocol not available
E0415 22:32:38.949586 15463 NebulaStore.cpp:47] Start the raft service failed
E0415 22:32:38.949597 15463 MetaDaemon.cpp:88] Nebula store init failed
E0415 22:32:38.949796 15463 MetaDaemon.cpp:215] Init kv failed!
Nebula service status is as follows:
[root#redhat6 scripts]# ./nebula.service status all
[WARN] The maximum files allowed to open might be too few: 1024
[INFO] nebula-metad: Exited
[INFO] nebula-graphd: Exited
[INFO] nebula-storaged: Running as 15547, Listening on 44500
Reason for error: CentOS 6.5 system kernel version is 2.6.32, which is less than 3.9. However, SO_REUSEPORT only supports Linux 3.9 and above.
Upgrading the system to CentOS 7.5 can solve the problem by itself.

Call failed to connect: Connection error (503)

I am trying to use audio call in app, But when I call from a device to other device, It does not connect with device and automatically disconnected with twilio Api. What is that problem occurred in app?
2018-11-21 10:43:32.226794+0530 AppName[243:9466] StartCallAction transaction request successful
2018-11-21 10:43:32.279094+0530 AppName[243:7164] providerDidBegin
2018-11-21 10:43:32.279737+0530 AppName[243:7164] provider:performStartCallAction:
WARNING: no real random source present!
2018-11-21 10:43:32.308053+0530 AppName[243:7164] [INFO Twilio] recreateMainTransport, Found valid IPv4 address: IPAddress
2018-11-21 10:43:32.309170+0530 AppName[243:9465] [INFO TVOMakeCallCommand] Call URI: sip:None#chunderm.gll.twilio.com;transport=tls
2018-11-21 10:43:32.722550+0530 AppName[243:7164] provider:didActivateAudioSession:
2018-11-21 10:43:38.396482+0530 AppName[243:9514] TIC TCP Conn Failed [72:0x15ef5ca50]: 1:61 Err(61)
2018-11-21 10:43:38.397055+0530 AppName[243:9514] Task <7129FEF4-4EBE-4AC5-9B34-5E0D002AE56F>.<1> HTTP load failed (error code: -1004 [1:61])
2018-11-21 10:43:38.399459+0530 AppName[243:9466] Task <7129FEF4-4EBE-4AC5-9B34-5E0D002AE56F>.<1> finished with error - code: -1004
2018-11-21 10:43:38.808257+0530 AppName[243:7164] Call failed to connect: Connection error (503).

org.openqa.selenium.remote.SessionNotFoundException: no such session

I am trying to automate mobile web automation test cases on android phone but I am getting the below error:-
org.openqa.selenium.remote.SessionNotFoundException: no such session
(Driver info: chromedriver=2.21.371461 (633e689b520b25f3e264a2ede6b74ccc23cb636a),platform=Linux 3.16.0-77-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 12 milliseconds
Please see the below code snippet:
ChromeOptions c=new ChromeOptions();
DesiredCapabilities dc = DesiredCapabilities.chrome();
dc.setCapability("browserName", "chrome");
dc.setCapability("appium-version", "1.6.0");
dc.setCapability("deviceName", "4d00b83ed4f7426f");
dc.setCapability(CapabilityType.VERSION, "5.0.1");
dc.setCapability("platformName", "Android");
dc.setCapability(ChromeOptions.CAPABILITY, c);
dc.setCapability("appPackage", "com.android.chrome");
dc.setCapability("appActivity", "com.google.android.apps.chrome.document.ChromeLauncherActivity");
driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), dc);
driver.manage().timeouts().implicitlyWait(25, TimeUnit.SECONDS);
In Appium server logs I am getting below error:
[ADB] Error: Unable to get pids for uiautomator. Orginial error: this.shell(...).trim is not a function at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13) at ADB.callee$0$0$ (lib/tools/adb-commands.js:441:9) at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runti‌​me/regenerator/runti‌​me.js:67:40) at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runti‌​me/regenerator/runti‌​me.js:315:22)
Usually this error comes up when:
Appium Server is not running
Connection with the Appium server is lost for any reason
Appium server misconfigured.
Make sure you have your Appium GUI app open and have a look at its console when the execution starts. You should see that the server is at least is up and getting your request. The from the log, try to see why it fails. If there is no response in Appium console and it just stays unchanged, that means that your configuration is wrong. Perhaps you are using an incorrect port.

Resources