I'm following the guides at https://docs.near.org/docs/tutorials/near-indexer
to test out an indexer. However, when I run
cargo check
An error shows up when building actix-cors:
Checking actix-cors v0.6.0-beta.2 (https://github.com/near/actix-extras.git?branch=actix-web-4-beta.6#eb38fbcc)
error[E0053]: method `error_response` has an incompatible type for trait
--> /<MY HOME DIR>/.cargo/git/checkouts/actix-extras-c37ac6c43c868d63/eb38fbc/actix-cors/src/error.rs:53:5
...
Looking at some actix issue here: https://github.com/actix/actix-web/issues/2185
I think it's due to something wrong in actix beta versioning. Is there a more stable version to use?
My Cargo toml file looks like this:
[package]
name = "example-indexer"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
near-indexer = { git = "https://github.com/nearprotocol/nearcore", rev="a668e4399655af513b0d90e0be694dad2448e6cd" }
actix = "=0.11.0"
openssl-probe = { version = "0.1.2" }
tokio = { version = "1.1", features = ["sync"] }
serde = { version = "1", features = [ "derive" ] }
serde_json = "1.0.55"
Related
I have lambdas that reference a layer, this layer is maintained by someone else and when a new
version is released I have to update my terraform code to put the latest version in the arn (here 19).
Is there a way, in the terraform script, to get the latest version and use it?
module "lambda_function" {
source = "terraform-aws-modules/lambda/aws"
function_name = "my-lambda1"
description = "My awesome lambda function"
handler = "index.lambda_handler"
runtime = "python3.8"
source_path = "../src/lambda-function1"
tags = {
Name = "my-lambda1"
}
layers = [
"arn:aws:lambda:eu-central-1:587522145896:layer:my-layer-name:19"
]
}
Thanks.
ps : this means the layer's terraform script is not in mine, it's an other script that I don't have access to.
You can use the aws_lambda_layer_version data source to discover the latest version.
For example:
module "lambda_function" {
source = "terraform-aws-modules/lambda/aws"
function_name = "my-lambda1"
description = "My awesome lambda function"
handler = "index.lambda_handler"
runtime = "python3.8"
source_path = "../src/lambda-function1"
tags = {
Name = "my-lambda1"
}
layers = [
data.aws_lambda_layer_version.layer_version.arn
]
}
data "aws_lambda_layer_version" "layer_version" {
layer_name = "my-layer-name"
}
Hello our golang project is using nogo for static code analysis. We also have a nogo-config.json file to exclude certain paths for some of the rules. I found that bazel build //... and bazel test //... all use the config(because they don't complain the shadow variable error configured in the nogo_config.json) however bazel coverage //... will report variable shadow error for code under foo/bar which means the bazel coverage didn't obey the nogo_config.json. Why? (I am using bazel 2.2.0, golang go1.13.6 darwin/amd64)
WORKSPACE file
go_register_toolchains(nogo = "#//:my_nogo")
BUILD.bazel file
load("#io_bazel_rules_go//go:def.bzl", "nogo")
nogo(
name = "my_nogo",
config = "nogo-config.json", # Exclude analysis of 3rd party libraries
visibility = ["//visibility:public"],
deps = [
"#org_golang_x_tools//go/analysis/passes/shadow:go_tool_library",
],
)
nogo_config.json
{
"shadow": {
"exclude_files": {
"external/*": "",
"foo/bar/*": "Some generated model files don't behave by these go rules"
}
},
}
I tried what seemed to be the straight-forward approach, and added a Package resource in my node configuration for the MongoDB MSI. I got the following error: "Could not get the https stream for file".
Here's the package configuration I tried:
package MongoDB {
Name = "MongoDB 3.6.11 2008R2Plus SSL (64 bit)"
Path = "https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-3.6.11-signed.msi"
ProductId = "88F7AA23-BDD2-4EBE-9985-EBB5D2E23E83"
Arguments = "ADDLOCAL=`"all`" SHOULD_INSTALL_COMPASS=`"0`" INSTALLLOCATION=`"C:\MongoDB\Server\3.6`""
}
(I had $ConfigurationData references in there, but substituted for literals for simplicity)
I get the following error:
Could not get the https stream for file
Possible TLS version issue? I found that Invoke-WebRequest needed the following to get it to work with that same mongo download URL. Is there a way to do this with the package resource?
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
Using nmap to interrogate both nodejs.org and fastdl.mongodb.org (which is actually on cloudfront) it was indeed true that TLS support differed. Node still supports TLS version 1.0, which so happens to work with PowerShell. But MongoDB's site only supports TLS versions 1.1 or 1.2.
As I mentioned in my question, I suspected that setting the .Net security protocol work, and indeed it does. There's no way to add arbitrary script to the DSC package resource, so I needed to make a script block just to run this code, and have the package resource depend on it.
This is what I got to work:
Node $AllNodes.Where{$_.Role -contains 'MongoDBServer'}.NodeName {
Script SetTLS {
GetScript = { #{ Result = $true } }
SetScript = { [Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls" }
TestScript = { $false } #Always run
}
package MongoDB {
Ensure = 'Present'
Name = 'MongoDB 3.6.11 2008R2Plus SSL (64 bit)'
Path = 'https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-3.6.11-signed.msi'
ProductId = ''
Arguments = 'ADDLOCAL="all" SHOULD_INSTALL_COMPASS="0" INSTALLLOCATION="C:\MongoDB\Server\3.6"'
DependsOn = '[Script]SetTLS'
}
...
I have just upgraded an Android project's build.gradle to use build version 3.3.0
com.android.tools.build:gradle:3.3.0
Doing so has created this warning:
WARNING: API 'variant.getAssemble()' is obsolete and has been replaced with 'variant.getAssembleProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getAssemble(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
Affected Modules: app
It is caused by this code in the app build.gradle:
android.applicationVariants.all { variant ->
variant.assemble.doLast {
variant.outputs.each { output ->
def apk = variant.outputs[0].outputFile
File versionInfo = new File(apk.parent, "versionInfo.properties")
versionInfo.text = "versionCode=${android.defaultConfig.versionCode}\nversionName=${android.defaultConfig.versionName}"
copy {
from "${versionInfo}"
into "$project.projectDir/temp_archive"
}
}
}
}
I haven't been able to find where I can rewrite this to make the warning disappear. I tried to follow this Stack Overflow post, but didn't make any progress. Any suggestions would be greatly appreciated.
I found a potential solution that has resolved the warning. Below is the code I am using. Leaving the question for now in case there is a better solution.
android.applicationVariants.all { variant ->
variant.getAssembleProvider().get().doLast {
variant.outputs.each { output ->
def apk = variant.outputs[0].outputFile
File versionInfo = new File(apk.parent, "versionInfo.properties")
versionInfo.text = "versionCode=${android.defaultConfig.versionCode}\nversionName=${android.defaultConfig.versionName}"
copy {
from "${versionInfo}"
into "$project.projectDir/temp_archive"
}
}
}
}
I'm trying to switch my simple project from Groovy to Kotlin in build scripts.
I'm using this plugin:
https://github.com/gigaSproule/swagger-gradle-plugin
I have this configuration in my build script:
swagger{
apiSource {
springmvc = false
locations = ['my.location']
schemes = ['https']
host = 'test.com:8080'
info {
title = 'My Service'
version = 'v1'
}
swaggerDirectory = "$buildDir/swagger"
}
To where shall I refer to in this situations?
Shall I do something like?
task( "swagger" ) {
...
}
It is not quite familiar for me.
Thanks.
In case anyone is still looking for this information, this is how you would do it using Gradle Kotlin DSL:
import com.benjaminsproule.swagger.gradleplugin.model.*
plugins {
id("com.benjaminsproule.swagger") version "1.0.0"
}
swagger {
apiSource(closureOf<ApiSourceExtension> {
springmvc = false
schemes = mutableListOf("https")
host = "test.com:8080"
info(closureOf<InfoExtension> {
title = "My Service"
version = "v1"
description = "My Service Description"
termsOfService = "http://www.example.com/termsOfService"
contact(closureOf<ContactExtension> {
email = "email#internet.com"
name = "A Developer"
url = "http://www.internet.com"
})
license(closureOf<LicenseExtension> {
url = "http://www.apache.org/licenses/LICENSE-2.0.html"
name = "Apache 2.0"
})
})
locations = mutableListOf("com.foo.fighting")
swaggerDirectory = "$buildDir/swagger"
})
}
I've tested it using Gradle v4.6.