We have created a function in Realm Service of MongoDB atlas.
We are passing an okta generated access token to this function to get it verified.
We are using below code in the function
const claims = oktaJwtVfr.verifyAccessToken(’$oktaaccesstoken’,‘api://default’);
But we are getting below error when we call this function.
{
"error": "'crypto' module: error verifying message",
"error_code": "FunctionExecutionError",
"link": "https://realm.mongodb.com/groups/6074931f0ea7xxxx1776f78d/apps/620543aa14c4be86edc27c06/logs?co_id=6210d675xx891e8aa7xx95"
}
We have added ‘#okta/jwt-verifier’ dependency in the code.
Any suggestion please ?
Related
I'm trying to make a request to the testnet but getting the following error:
HTTP Request Error: An error occurred when interacting with the Access API.
transport=FetchTransport
error=Failed to fetch hostname=access.devnet.nodes.onflow.org:9000
path=/v1/scripts?block_height=sealed
method=POST
requestBody={
"script":"aW1wb3J0IEZ1bmdpYmxlVG9rZW4gZnJvbSAweDlhMDc2NmQ5M2I2NjA4YjcKaW1wb3J0IEZVU0QgZnJvbSAweGUyMjNkOGE2MjllNDljNjgKCnB1YiBmdW4gbWFpbihhZGRyZXNzOiBBZGRyZXNzKTogVUZpeDY0IHsKICAgIGxldCBhY2NvdW50ID0gZ2V0QWNjb3VudChhZGRyZXNzKQoKICAgIGxldCB2YXVsdFJlZiA9IGFjY291bnQuZ2V0Q2FwYWJpbGl0eSgvcHVibGljL2Z1c2RCYWxhbmNlKSEKICAgICAgICAuYm9ycm93PCZGVVNELlZhdWx0e0Z1bmdpYmxlVG9rZW4uQmFsYW5jZX0+KCkKICAgICAgICA/PyBwYW5pYygiQ291bGQgbm90IGJvcnJvdyBCYWxhbmNlIHJlZmVyZW5jZSB0byB0aGUgVmF1bHQiKQoKICAgIHJldHVybiB2YXVsdFJlZi5iYWxhbmNlCn0=",
"arguments":["eyJ0eXBlIjoiQWRkcmVzcyIsInZhbHVlIjoiMHg1ODA2MjJlNzQ1MTgzYjE2In0="]
}
The base64 decoded script is:
import FungibleToken from 0x9a0766d93b6608b7
import FUSD from 0xe223d8a629e49c68
pub fun main(address: Address): UFix64 {
let account = getAccount(address)
let vaultRef = account.getCapability(/public/fusdBalance)!
.borrow<&FUSD.Vault{FungibleToken.Balance}>()
?? panic("Could not borrow Balance reference to the Vault")
return vaultRef.balance
}
and the arguments are:
{"type":"Address","value":"0x580622e745183b16"}
When I run the following command in the cli, it works: flow scripts execute -n testnet scripts/getFUSDBalance.cdc --arg "Address:580622e745183b16"
not sure why I'm getting issues with this
EDIT:
didn't mention that the error is coming from FCL
Here's the code I'm using to interact with Flow:
async getFUSDBalance(): Promise<Result<number, string>> {
const scriptText = getFUSDBalance as string;
const user = await this.getCurrentUser();
return await flow.query<number>({
cadence: scriptText,
payer: fcl.authz,
authorizations: [fcl.authz],
args: (arg, t) => [
arg(user.addr, t.Address)
]
})
}
flow.query<T> is just a wrapper for fcl.query
It works in the CLI but not from FCL
EDIT 2:
So I found that the real issue I was facing was I was getting this error:
Fetch API cannot load access.devnet.nodes.onflow.org:9000/v1/scripts?block_height=sealed. URL scheme "access.devnet.nodes.onflow.org" is not supported
access.devnet.nodes.onflow.org:9000 is gRPC (I think). I should have been using https://rest-testnet.onflow.org. However, when I change to that I get a CORS violation. I think I read somewhere that you can't access the testnet from localhost (why?), but I deployed to a *.app domain and I'm getting the same error No 'Access-Control-Allow-Origin' header is present on the requested resource. Is the CORS policy not set up for *.app domains?
So turns out changing to https://rest-testnet.onflow.org for the accessNode.api value did work. Not sure why it didn't when I posted the second edit, but whatever. This works for localhost too.
I have the following error trying to create a static website inspired by https://github.com/aws-samples/aws-cdk-examples/blob/master/typescript/static-site/static-site.ts
const certificateArn = new acm.DnsValidatedCertificate(
this,
"SiteCertificateR53",
{
domainName: props.siteDomain,
hostedZone: props.zone,
region: "us-east-1", // Cloudfront only checks this region for certificates.
}
).certificateArn;
new cdk.CfnOutput(this, "CertificateR53", {value: certificateArn});
Error:
Received response status [FAILED] from custom resource. Message returned: Resource is not in the state certificateValidated
If you don't need to do cross region stuff (e.g. us-east-1 needs a resource from us-west-2) using the following method provides the same benefit as DnsValidatedCertificate
const certificate = new acm.Certificate(this, `SiteCertificateR53`, {
domainName: props.siteDomain,
validation: acm.CertificateValidation.fromDns(props.zone)});
If you still gotta do cross-region stuff, then you should create and deploy your zone via AWS console first. That won't guarantee a fix though, this page can help if you're still stuck: https://docs.aws.amazon.com/acm/latest/userguide/troubleshooting-DNS-validation.html
I'm trying to run some very basic cloud code function on my parse-server and I get the same error every time: 141 Invalid function. I'm just adding a main.js file with my function in the cloud directory and trying to call it using Postman, but it looks like the file is not even called.
I've tried locally and on a docker, if the function exist or not I get the same result, and tried restarting the docker container after adding the code. I also tried adding a body to the request with parameters like master and functionName.
Here's my cloud code function (cloud/main.js):
Parse.Cloud.define('hello', function(req, res) {
return "function called";
});
Calling the function with a POST request on https://myurl/parse/functions/hello
and getting:
{
"code": 141,
"error": "Invalid function: \"hello\""
}
The response object has been removed from Parse Server Cloud Code post v3.0.0.
Your Cloud Code function should look like this...
Parse.Cloud.define("hello", async (request) => {
return "function called";
});
Please read the migration guide for more details on updating your cloud code to v3.0.0 or above.
When I tried other rest apis for Azure Mangement, it works without any issue. But when I try this recommendedElasticPools , I am getting internal server error all times.
{
"code": "InternalServerError",
"message": "There was an internal server error that occurred during this request.",
"target": null,
"details": [],
"innererror": []
}
We had a problem with this API that should be fixed now. Thanks for reporting this. The API you were calling is on the deprecation path and I recommend using new API instead:
/subscriptions/{SubscriptionId}/resourcegroups/{GroupName}/providers/Microsoft.sql/servers/{ServerName}/elasticPoolEstimates/
While following the steps in 'Deploying your chaincode from IBM Bluemix Blockchain documentation, I'm getting the following error:
Response Body
{
"jsonrpc": "2.0",
"error": {
"code": -32001,
"message": "Deployment failure",
"data": "Error when deploying chaincode: Error getting chaincode package bytes: Error getting code 'go get' failed with error: \"exit status 2\"\n# github.com/VrushaliW1/BluemixApp1\n/opt/gopath/_usercode_/583850129/src/github.com/VrushaliW1/BluemixApp1/Asgn1.go:38: stub.GetFunctionAndParameters undefined (type shim.ChaincodeStubInterface has no field or method GetFunctionAndParameters)\n/opt/gopath/_usercode_/583850129/src/github.com/VrushaliW1/BluemixApp1/Asgn1.go:75: stub.GetFunctionAndParameters undefined (type shim.ChaincodeStubInterface has no field or method GetFunctionAndParameters)\n/opt/gopath/_usercode_/583850129/src/github.com/VrushaliW1/BluemixApp1/Asgn1.go:193: cannot use new(SimpleChaincode) (type *SimpleChaincode) as type shim.Chaincode in argument to shim.Start:\n\t*SimpleChaincode does not implement shim.Chaincode (wrong type for Init method)\n\t\thave Init(shim.ChaincodeStubInterface) ([]byte, error)\n\t\twant Init(shim.ChaincodeStubInterface, string, []string) ([]byte, error)\n"
},
"id": 0
}
Tried referring to the links :
IBM Blockchain (Hyperledger) - "Error when deploying chaincode"
"Error getting chaincode package bytes" when deploying chaincode on hyperledger via REST
The go code build rightly but still I'm getting this failure error with 'Shim interface' issue. Is still anything wrong in the Go code?
The issue appears to be related to the Go code in the Asgn1.go file. The message is indicating that the signature of the Init function was Init(shim.ChaincodeStubInterface) ([]byte, error) rather than Init(shim.ChaincodeStubInterface, string, []string) ([]byte, error).
For an example chaincode that works with Hyperledger Fabric version 0.6.1, refer to the “Learn Chaincode” example chaincode at https://github.com/IBM-Blockchain/learn-chaincode/blob/v2.0/finished/chaincode_finished.go. Note that the signature of the Init function is Init(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error).