"invalid peer certificate contents..." while running `slack run` using slack-cli running on deno - slack-api

I am on MacOS (M1) trying to run slack run. When I call the Workflow and submit very simple form, I get error:
🚫 Error: exit status 1
error: Uncaught (in promise) TypeError: error sending request for url (https://slack.com/api/functions.completeSuccess): error trying to connect: invalid peer certificate contents: invalid peer certificate: UnknownIssuer
const resp = await fetch(url, {
^
at async mainFetch (deno:ext/fetch/26_fetch.js:247:14)
at async fetch (deno:ext/fetch/26_fetch.js:464:9)
at async BaseSlackAPIClient.apiCall (https://deno.land/x/deno_slack_api#0.0.2/base-client.ts:20:18)
at async RunFunction (https://deno.land/x/deno_slack_runtime#0.5.0/run-function.ts:57:5)
at async DispatchPayload (https://deno.land/x/deno_slack_runtime#0.5.0/dispatch-payload.ts:64:16)
at async runLocally (https://deno.land/x/deno_slack_runtime#0.5.0/local-run-function.ts:29:16)
at async https://deno.land/x/deno_slack_runtime#0.5.0/local-run-function.ts:50:3
Slack version:
Using slack v1.16.4
Deno version:
deno 1.28.3 (release, aarch64-apple-darwin)
v8 10.9.194.5
typescript 4.8.3
Can anyone help on this please?
I tried to submit workflow form that is supposed to input a message and enrich it and send it back to channel.

If you are behind a proxy you can set the HTTP_PROXY and the HTTPS_PROXY environment variables.
Or if you need to load a CA from a local pem file you can set the DENO_CERT variable
see Deno Environment Documentation

Related

Stackstorm: Action "packs.install" cannot be found

I am currently having issues installing any pack at all in stackstorm using the st2 client.
Error:
ERROR: 400 Client Error: Bad Request
MESSAGE: Action "packs.install" cannot be found. for url: http://sts-st2api:9101/packs/install
Environment: Running Kubernetes on local kind cluster
To repoduce:
Exec into the st2 client pod
Then login to the st2 using: st2 login -w st2admin
Install any pack

createMinToInstruction authorized by PDA, works fine in LocalNet, but gives "Account not associated with this Mint" when run on DevNet

I create an automate deployment script that will mint 2million SPL tokens to an address, the mint is owned by the program PDA as shown in Solana explorer:
Bellow is the last step in the deployment script:
export async function mint2e6Tokens(provider: anchor.AnchorProvider, tokenAccount: PublicKey, mint: PublicKey): Promise<void> {
// get the token account could be PDA
const programKeypair = await createKeypairFromFile(PROGRAM_KEYPAIR_PATH);
/** Load from PDA */
let mint_tokens_tx = new Transaction().add(
createMintToInstruction(
mint,
tokenAccount,
programKeypair.publicKey, // -> I DOUBLE CHECKED, THIS IS 6Z24B3qCrWfWvDo1f2HgxmnBSGhqQes1sHobqMtMxfbP
2e6,
[],
TOKEN_PROGRAM_ID
)
);
// We sign with our programId instead of the wallet because this is a PDA
// Program Derived Adress
await provider.sendAndConfirm(mint_tokens_tx, [programKeypair]);
}
When I run in LocalNet, it works:
Migrating to LocalNet...
RUNNING CUSTOM SCRIPT ====>>>
Payper: EsgJ9ihTEZskWyWpMMPuGVisy5ay76YWgetgTLb3jRmj
Using program 6Z24B3qCrWfWvDo1f2HgxmnBSGhqQes1sHobqMtMxfbP
Program: 6Z24B3qCrWfWvDo1f2HgxmnBSGhqQes1sHobqMtMxfbP
Mint: AVPgrT1y6ZfjGWPyLCWEPZdogRgmEMbrdRbcHNSfAPzF
Campaign: FcAmyEgZsXUKLB6hKufDmLuSBzMzVtPmRPm7vZLStK4U
31999500
However when I switch to DevNet, it always give me error
Migrating to DevNet...
RUNNING CUSTOM SCRIPT ====>>>
Payper: EsgJ9ihTEZskWyWpMMPuGVisy5ay76YWgetgTLb3jRmj
Using program 6Z24B3qCrWfWvDo1f2HgxmnBSGhqQes1sHobqMtMxfbP
Program: 6Z24B3qCrWfWvDo1f2HgxmnBSGhqQes1sHobqMtMxfbP
Mint: AVPgrT1y6ZfjGWPyLCWEPZdogRgmEMbrdRbcHNSfAPzF
Campaign: FcAmyEgZsXUKLB6hKufDmLuSBzMzVtPmRPm7vZLStK4U
SendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x3
at Connection.sendEncodedTransaction (/code/beens/node_modules/#solana/web3.js/src/connection.ts:4248:13)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Connection.sendRawTransaction (/code/beens/node_modules/#solana/web3.js/src/connection.ts:4210:20)
at async sendAndConfirmRawTransaction (/code/beens/node_modules/#project-serum/anchor/src/provider.ts:288:21)
at async AnchorProvider.sendAndConfirm (/code/beens/node_modules/#project-serum/anchor/src/provider.ts:148:14) {
logs: [
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]',
'Program log: Instruction: MintTo',
'Program log: Error: Account not associated with this Mint',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2809 of 200000 compute units',
'Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA failed: custom program error: 0x3'
]
}
Why the authority is right, but Solana complain that Error: Account not associated with this Mint?
It turns out that my versions for Solana, Anchor and Rust are not compatible with DevNet and / or testnet.
I upgrade solana to main net recommended version and it works. One more things to mention that don't forget to run "solana program close --buffers" before trying. My current settings are:
root#d4c64206ce03:/code# solana --version
solana-cli 1.10.31 (src:77a40cd8; feat:4192065167)
root#d4c64206ce03:/code# rustc --version
rustc 1.63.0 (4b91a6ea7 2022-08-08)
root#d4c64206ce03:/code# anchor --version
anchor-cli 0.25.0

getting this error while trying to run cube js

I'm getting this error while trying to run cube js with the default command in the getting started docs. I've started this in a folder and running it in docker.
Warning. There is no cube.js file. Continue with environment variables
πŸ”₯ Cube Store (0.28.31) is assigned to 3030 port.
Warning. Option apiSecret is required in dev mode. Cube.js has generated it as e3b8c5a35fe378f4d481ada777e5f3c4
πŸ”“ Authentication checks are disabled in developer mode. Please use NODE_ENV=production to enable it.
πŸ¦… Dev environment available at http://localhost:4000
πŸš€ Cube.js server (0.28.31) is listening on 4000
2021-09-03 15:06:01,512 INFO [cubestore::http::status] <pid:17> Serving status probes at 0.0.0.0:3031
2021-09-03 15:06:01,515 INFO [cubestore::metastore] <pid:17> Using existing metastore in /cube/conf/.cubestore/data/metastore
thread '
main
' panicked at '
called `Result::unwrap()` on an `Err` value: Error { message: "IO error: While fsync: a directory: Invalid argument" }
', /project/cubestore/src/metastore/mod.rs:1542:40
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Cube Store Start Error: undefined
I guess it’s corrupted metastore due to it was incorrectly shutdown for you locally. Could you please try to drop the .cubestore directory?

I am not able to call rest api which is in another container running at localhost:9090, using localstack 12.5 lambda (running at 4566 port)

localstack 12.5
dummy.py file for lambda hanlder
import sys
import requests
def handler(event, context):
print("Inside handler")
x = requests.get('http://localhost:9090/ping')
print(x.status_code)
return str(x.content)
In handler when i am calling get api which is in another container i am getting connection refused error.
Error:
"ConnectionError","errorMessage":"HTTPConnectionPool(host='localhost', port=9090): Max retries exceeded with url:
Caused by NewConnectionError('\u003curllib3.connection.HTTPConnection object at 0x7ff8185c8ad0\u003e: Failed to establish a new connection:
However with postman I am able to hit http://localhost:9090/ping API
Also If I replace x = requests.get('https://w3schools.com') then I am getting 200 .
The issue has been resolved by adding below env variable in localstack
LAMBDA_DOCKER_NETWORK="host"

Composer rest server can't connect to ca.org1.example.com

I followed this tutorial to setup myorg/composer-rest-server and everything was working fine till I import card but when I make a GET request to /api/system/ping it returns 500 Error:
{"error":{"statusCode":500,"name":"Error","message":"Error trying login and get user Context. Error: Error trying to enroll user or load channel configuration. Error: Calling enrollment endpoint failed with error [Error: connect ECONNREFUSED 127.0.0.1:7054]","stack":"Error: Error trying login and get user Context. Error: Error trying to enroll user or load channel configuration. Error: Calling enrollment endpoint failed with error [Error: connect ECONNREFUSED 127.0.0.1:7054]\n at client.getUserContext.then.then.catch (/home/composer/.npm-global/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:393:34)\n at <anonymous>\n at process._tickDomainCallback (internal/process/next_tick.js:228:7)"}}
So I checked the logs for rest container, it can't seem to find 127.0.0.1:7054. Here is the error log.
Unhandled error for request GET /api/system/ping: Error: Error trying login and get user Context. Error: Error trying to enroll user or load channel configuration. Error: Calling enrollment endpoint failed with error [Error: connect ECONNREFUSED 127.0.0.1:7054]
at client.getUserContext.then.then.catch (/home/composer/.npm-global/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:393:34)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:228:7)
So I checked the logs for the container ca.org1.example.com, and it is listening to port 7054
2018/04/01 09:57:25 [DEBUG] CA initialization successful
2018/04/01 09:57:25 [INFO] Home directory for default CA: /etc/hyperledger/fabric-ca-server
2018/04/01 09:57:25 [DEBUG] 1 CA instance(s) running on server
2018/04/01 09:57:25 [INFO] Listening on http://0.0.0.0:7054
I think i need to change 127.0.0.1 to 0.0.0.0 but not sure how to do it the right way. Could also be a firewall issue?
Here's my .composer/cards/restadmin#myserver/connection.json
{"name":"hlfv1","x-type":"hlfv1","x-commitTimeout":300,"version":"1.0.0","client":{"organization":"Org1","connection":{"timeout":{"peer":{"endorser":"300","eventHub":"300","eventReg":"300"},"orderer":"300"}}},"channels":{"composerchannel":{"orderers":["orderer.example.com"],"peers":{"peer0.org1.example.com":{}}}},"organizations":{"Org1":{"mspid":"Org1MSP","peers":["peer0.org1.example.com"],"certificateAuthorities":["ca.org1.example.com"]}},"orderers":{"orderer.example.com":{"url":"grpc://orderer.example.com:7050"}},"peers":{"peer0.org1.example.com":{"url":"grpc://peer0.org1.example.com:7051","eventUrl":"grpc://peer0.org1.example.com:7053"}},"certificateAuthorities":{"ca.org1.example.com":{"url":"http://ca.org1.example.com:7054","caName":"ca.org1.example.com"}}}
I'm using AWS EC2
OS: Ubuntu 16.04.3 LTS,
Docker: 17.12.0-ce,
Composer: v0.19.0
Fabric: v1.1
Which card have you imported? If it is the restadmin card, I think you may have imported a Card containing an expired One-Time secret. After the rest admin card was used to start the REST server (in the container) the secret was replaced with certificates - so if you export the restadmin card again with a different name composer card export -c restadmin#trade-network -f restadmin-cert.card you will see that it is a larger file because of the certificates. You should be able to import and use this new .card file.
(If you were using a different card e.g. jdoe - did you run the sed command for this card to correct the addresses?)

Resources