I tryed to use the SqlTools extansion for VSCorde and wanted to run the script with it and gives me this erros (I'm using github codespaces)
[1674681282366] INFO (ext): EXECUTING COMMAND => sqltools.getConnections
[1674681282367] INFO (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1674681282368] INFO (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1674681282369] INFO (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1674681284190] INFO (ext): EXECUTING COMMAND => sqltools.getConnections
[1674681284191] INFO (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1674681284191] INFO (ls): REQUEST RECEIVED => connection/ConnectRequest
[1674681284192] INFO (ls): Connection instance created for panel.
ns: "conn-manager"
[1674681284193] ERROR (ls): {"code":-1,"data":{"driver":"MySQL","driverOptions":{"mysqlOptions":{"authProtocol":"default"}}},"name":"Error"}
ns: "conn"
[1674681284193] ERROR (ls): Connecting error: {"code":-1,"data":{"driver":"MySQL","driverOptions":{"mysqlOptions":{"authProtocol":"default"}}},"name":"Error"}
ns: "conn-manager"
[1674681284193] ERROR (ls): Open connection error
ns: "conn-manager"
[1674681284194] ERROR (ext): ERROR: Error fetching records. connect ECONNREFUSED 127.0.0.1:3306, {"code":-1,"data":{"driver":"MySQL","driverOptions":{"mysqlOptions":{"authProtocol":"default"}}}}
ns: "error-handler"```
I am trying compile a function with user id, but not working out. Tried different ways but getting nil as response in my production logs.
Any help is welcome
def function(user)
attachments['example.pdf'] = File.read("public/#{#user.id}_file.pdf")
#user = user
mail :subject => 'example', to: user.email, from: 'invoice#domain.com', track_opens: true
end
Log:
D, [2019-07-08T10:51:56.838759 #64733] DEBUG -- :
TestMailer#send_sub_month: processed outbound mail in 1.1ms I,
[2019-07-08T10:51:56.839003 #64733] INFO -- : Completed 500 Internal
Server Error in 5ms (ActiveRecord: 0.4ms) F,
[2019-07-08T10:51:56.839615 #64733] FATAL -- : F,
[2019-07-08T10:51:56.839671 #64733] FATAL -- : NoMethodError
(undefined method 'id' for nil:NilClass): F,
[2019-07-08T10:51:56.839710 #64733] FATAL -- : F,
[2019-07-08T10:51:56.839750 #64733] FATAL -- :
app/mailers/test_mailer.rb:90:in `send_sub_month'
The logs say that you are trying to access the id attribute of an empty object.
NoMethodError (undefined method id' for nil:NilClass)
You have a string where the user is used is higher than the string where the user is defined
Try this:
def function(user)
#user = user
attachments['example.pdf'] = File.read("public/#{#user.id}_file.pdf")
mail :subject => 'example', to: user.email, from: 'invoice#domain.com', track_opens: true
end
Updated.
If you pass a user as an argument to a function, then it makes no sense to create a variable for it.
def function(user)
attachments['example.pdf'] = File.read("public/#{user.id}_file.pdf")
mail :subject => 'example', to: user.email, from: 'invoice#domain.com', track_opens: true
end
I've been trying to create an uploader for avatars, but I've been facing some issues, the code works perfectly on dev, but on the production release, I get this error:
=SUPERVISOR REPORT==== 8-Jul-2016::22:35:41 ===
Supervisor: {local,'Elixir.ExAws.Supervisor'}
Context: child_terminated
Reason: {#{'__exception__' => true,
'__struct__' => 'Elixir.Poison.SyntaxError',
message => <<"Unexpected token: <">>,
token => <<"<">>},
[{'Elixir.Poison.Parser','parse!',2,
[{file,"lib/poison/parser.ex"},{line,56}]},
{'Elixir.Poison','decode!',2,
[{file,"lib/poison.ex"},{line,83}]},
{'Elixir.ExAws.InstanceMeta',security_credentials,1,
[{file,"lib/ex_aws/instance_meta.ex"},{line,16}]},
{'Elixir.ExAws.Config.AuthCache',refresh_config,2,
[{file,"lib/ex_aws/config/auth_cache.ex"},{line,37}]},
{'Elixir.ExAws.Config.AuthCache',handle_call,3,
[{file,"lib/ex_aws/config/auth_cache.ex"},{line,27}]},
{gen_server,try_handle_call,4,
[{file,"gen_server.erl"},{line,615}]},
{gen_server,handle_msg,5,
[{file,"gen_server.erl"},{line,647}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,247}]}]}
Offender: [{pid,<0.2009.0>},
{id,'Elixir.ExAws.Config.AuthCache'},
{mfargs,
{'Elixir.ExAws.Config.AuthCache',start_link,
[[{name,'Elixir.ExAws.Config.AuthCache'}]]}},
{restart_type,permanent},
{shutdown,5000},
{child_type,worker}]
22:35:41.624 [error] Ranch protocol #PID<0.2011.0> (:cowboy_protocol) of listener MyApp.Endpoint.HTTP terminated
** (exit) exited in: GenServer.call(ExAws.Config.AuthCache, {:refresh_config, %ExAws.S3{config: %{access_key_id: [{:system, "AWS_ACCESS_KEY_ID"}, :instance_role], host: %{"ap-northeast-1" =>
"s3-ap-northeast-1.amazonaws.com", "ap-southeast-1" => "s3-ap-southeast-1.amazonaws.com", "ap-southeast-2" => "s3-ap-southeast-2.amazonaws.com", "eu-central-1" => "s3-eu-central-1.amazonaws.c
om", "eu-west-1" => "s3-eu-west-1.amazonaws.com", "sa-east-1" => "s3-sa-east-1.amazonaws.com", "us-east-1" => "s3.amazonaws.com", "us-west-1" => "s3-us-west-1.amazonaws.com", "us-west-2" => "
s3-us-west-2.amazonaws.com"}, http_client: ExAws.Request.HTTPoison, json_codec: Poison, region: "us-east-1", scheme: "https://", secret_access_key: [{:system, "AWS_SECRET_ACCESS_KEY"}, :insta
nce_role]}, service: :s3}}, 5000)
** (EXIT) an exception was raised:
** (Poison.SyntaxError) Unexpected token: <
(poison) lib/poison/parser.ex:56: Poison.Parser.parse!/2
(poison) lib/poison.ex:83: Poison.decode!/2
(ex_aws) lib/ex_aws/instance_meta.ex:16: ExAws.InstanceMeta.security_credentials/1
(ex_aws) lib/ex_aws/config/auth_cache.ex:37: ExAws.Config.AuthCache.refresh_config/2
(ex_aws) lib/ex_aws/config/auth_cache.ex:27: ExAws.Config.AuthCache.handle_call/3
(stdlib) gen_server.erl:615: :gen_server.try_handle_call/4
(stdlib) gen_server.erl:647: :gen_server.handle_msg/5
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Thanks.
Your stack trace says that Poison, a dep that ExAws uses, failed to decode a json. If you check the module that made that call (lib/ex_aws/instance_meta.ex, you can read it here), you'll find that it communicates with Amazon to check your credentials.
The most probable thing is that your configuration is incorrect and Amazon is sending you an error message formatted as an XML or HTML (both begin with <).
ExAws config depends on env vars, so that's also probably why it works on dev, but not on production.
I'm triyng to test a rest api using jmeter script. When I launch the test, I get the following exception:
{"timestamp" : 1463775753585,
"status" : 400,
"error" : "Bad Request",
"exception" : "org.springframework.http.converter.HttpMessageNotReadableException",
"message" : "Could not read JSON: (was java.lang.NullPointerException) (through reference chain: com.tutos.example.models.Product[\"category\"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: com.tutos.example.models.Product[\"category\"])",
"path" : "/product"
}
Here is my data of post:
{"code":${productCode}, "intitule":"${productName}", "cost":"${cost}", "category":{"id":"${categoryId}"}}
But when I remove the property category, everything is OK.
What am I missing please ?
While running the code with necessary validations, the test cases are not executed. It throws the following error message.
1) Frisby Test: Test case for single post
Message:
Expected 500 to equal 201.
Stacktrace:
Error: Expected 500 to equal 201.
at null.<anonymous> (/home/admin/wrkspc/api-tests/node_modules/frisby/lib/frisby.js:462:42)
at null.<anonymous> (/home/admin/wrkspc/api-tests/node_modules/frisby/lib/frisby.js:1043:43)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
2) Frisby Test: Test case for single post
Message:
Error: Error parsing JSON string: Unexpected '<'
Given: <html><head><title>Apache Tomcat/7.0.53 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.53</h3></body></html>
Stacktrace:
Error: Error parsing JSON string: Unexpected '<'
Given: <html><head><title>Apache Tomcat/7.0.53 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.53</h3></body></html>
at _jsonParse (/home/admin/wrkspc/api-tests/node_modules/frisby/lib/frisby.js:1174:11)
at Frisby.<anonymous> (/home/admin/wrkspc/api-tests/node_modules/frisby/lib/frisby.js:919:20)
at null.<anonymous> (/home/admin/wrkspc/api-tests/node_modules/frisby/lib/frisby.js:1081:18)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
Error: Expected 500 to equal 201.
Means that what you are testing is throwing an error.
Error parsing JSON string: Unexpected '<'
Just means that the response you received was not in proper JSON format. In this case, it seems to be html. This second error is expected your system under test is throwing an error message in the format it is comfortable with, html, and not in JSON.
The real error:
The server encountered an internal error that prevented it from fulfilling this request.
You can use the inspectBody() to you see return of the test.
More informations: http://frisbyjs.com/docs/api/#inspectBody()