How to turn on icloud sharing on Production environment? - ios

I have a key in Myapp.entitlements:
com.apple.developer.icloud-container-environment
and value: Development.
With above when I try to share the record using UICloudSharingController then everything is fine, and it is shared. But when I change above key to Production what is intended for me, it doesn't work.
Always got a response:
Failed to modify some records. What is going on?
Should I somewhere turn it on? A new entity in cloudkit dashboard or something else?
The exact error is:
Optional(<CKError 0x1c144b520: "Partial Failure" (2/1011); "Failed to modify some records"; uuid = 7580FED7-25A0-430C-A16C-610A506F4309; container ID = "iCloud.pl.blueworld.fieldservice"; partial errors: {
Share-54BD438F-BA4F-46EE-8B71-403CFA780D3F:(fieldservice:__defaultOwner__) = <CKError 0x1c1448c10: "Invalid Arguments" (12/2006); server message = "Cannot create a new type in production schema"; uuid = 7580FED7-25A0-430C-A16C-610A506F4309>
... 1 "Batch Request Failed" CKError's omitted ...
}>)

This line in the error message looks like the problem:
server message = "Cannot create a new type in production schema";
It looks like you haven't deployed your (latest) schema from the dev environment to the prod environment in the cloudkit dashboard. You've just told your app to look at the prod environment.

Related

Terraform code for "backup_blob_container_uri"

resource "azurerm_analysis_services_server" "server" {
name = "analysisservicesserver"
location = "northeurope"
resource_group_name = azurerm_resource_group.rg.name
sku = "S0"
admin_users = ["myuser#domain.tld"]
enable_power_bi_service = true
backup_blob_container_uri = ("https://${STORAGE ACCOUNT NAME}.blob.core.windows.net/${CONTAINER NAME}%s", Blob SAS TOKEN)
*Storage Firewall disable
*Original Error: Code="BadRequest" Message="Invalid backup blob container 'The remote server returned an error: (403) Forbidden.'. Azure blob storage documentation can be found here: https://go.microsoft.com/fwlink/?linkid=2106906"
*I am able to add same container via portal without any error
*I also try to copy and past "Blob SAS URL" directly from storage still the same error
Tested in my environment getting the same error even changing the provider version. Might azurerm_analysis_services_server outdated for backup_blob_container_uri
You can refer this Github Disccusion there was same error reported long back you can follow with them might be there will be new release for this to sort out this error.

Action Mailbox saying "Missing required Mailgun API key" even though key is present

I have Mailgun set up to forward emails to my /rails/action_mailbox/mailgun/inbound_emails/mime endpoint.
When my endpoint receives the request, it gives the following error:
ArgumentError (Missing required Mailgun API key. Set
action_mailbox.mailgun_api_key in your application's encrypted
credentials or provide the MAILGUN_INGRESS_API_KEY environment
variable.)
However, MAILGUN_INGRESS_API_KEY is in fact set. When I run ENV["MAILGUN_INGRESS_API_KEY"] in the console, I see my API key. I even pasted in the API key determination code from GitHub to see if there was a problem there, but the return value I got was my actual API key.
Any ideas on what the problem could be?
Just checking few things to see if can rectify, as I understand you know much better than me about rails.
Do you have setup mailgun api_key in environment configuration like for development config/environments/development.rb
config.action_mailer.delivery_method = :mailgun
config.action_mailer.mailgun_settings = {
api_key: ENV['MAILGUN_INGRESS_API_KEY'],
domain: 'your_domain.com',
# api_host: 'api.eu.mailgun.net' # Uncomment this line for EU region domains
}
Now let us do one test, visit (bin.mailgun.net) and get paste bin url then run rails c
mg_client = Mailgun::Client.new(ENV["MAILGUN_INGRESS_API_KEY"], "bin.mailgun.net", "aecf68de_you_got_visiting_site", ssl = false)
message_params = { from: 'bob#sending_domain.com',
to: 'sally#example.com',
subject: 'The Ruby SDK is awesome!',
text: 'It is really easy to send a message!'
}
result = mg_client.send_message("your_sending_setup_on_mailgun_domain.com", message_params)
puts result.inspect
See what message came and you may get idea. There could be environment configuration issue also for development you have to setup different then for production. Also check on paste-bin does it got any hit.

Serverless - Change the content before deploy

I'm using Serverless for working with our aws lambda / appsync.
For Error Handling, we are keep erro code with message in a json file. The Codes will be unique. Something like this:
//error-code.json
{
"1"": { code: 1, message: "Invalid User Input"},
"2"": { code: 2, message: "Invalid Input"},
//... so on
}
This wil lbe deploy as layer and all the lambda will use it. Issue is we cannot use it in the resolve template. There are some of the resolver will be only template file. These template files cannot access the json file nor can access the layer. How can I use the error-code.json here?
Solution 1:
Manually write the error code in templates and make sure there are alway unique. Something like this:
#set(#errorInfo = {
"erroCode": "1",
"errorMessage": "Invalid Input"
})
$util.error("Invalid Input", "errorType", $ctx.arguments,#errorInfo)
Rejected: Becasue we have to manually check everytime for the unique of error code. In case of lot of template file, we cannot rely on it.
Solution 2:
Create a table with error code (unique) and error message. Use this table to send error from template.
Rejected: Because we use multiple app sync instance and they all connect to dirferent database. So we have to make this table in all database, and thus unique across the app-sync is not maintained.
Solution 3:
Write the placeholder in vtl where we want to send the error. Before Deploy, replace the placeholder with the actual code using pre-hook script, but not in the actual vtl file but in the generated package that serverless deploy. Does Serverless even such thing?
if your errors are all static, there is one more option for consideration.
You create one more file that holds all errors defined in Velocity.
$util.qr( $ctx.stash.put("errors", {}) ) $util.qr(
$util.qr( $ctx.stash.errors.put("ONE", { "code": 1, "message": "Invalid User
Input"} )
...
$util.qr( $ctx.stash.errors.put("TWENTY", { "code": 20, "message": "20th error description"} )
For every velocity resolver that throws errors, you inject pre-defined errors at the beginning of its request mapping's file. Whenever you want to throw an error, it's done by retrieving a pre-defined error from $ctx.stash
$util.error ( $ctx.stash.errors.ONE.message, $ctx.stash.errors.ONE.code )
The error file is generated from error-code.json, or manually typed again for simplicity. $ctx.stash is used because stash is accessible from everywhere in a resolver, including pipeline ones.

Paypal-express gem, working in dev but not in prod

So I have an issue I can't figure out alone.
I have run some test on my app and when launch in dev it's working perfectly but as soon as it's on Prod and so it uses the real identificator, it doesn't work anymore.
I got this error:
Paypal::Exception::APIError (PayPal API Error: 'Security error'):
/offers_controller.rb:218:in choose_step'
if Rails.env.production?
response = request.setup(
payment_request,
"http://www.workiz.com/recruteurs/paypal_callback/" + params[:app_id],
"http://www.workiz.com/recruteurs/offres",
paypal_options # Optional
)
else # Development ou Test
response = request.setup(
payment_request,
"http://localhost:3000/recruteurs/paypal_callback/" + params[:app_id],
"http://localhost:3000/recruteurs/offres",
paypal_options # Optional
)
end
That is the line that crash, so it's when I call request.setup
The request is created like that:
if Rails.env.development?
Paypal.sandbox!
Paypal::Express::Request.new(
username: ENV['PAYPAL_SANDBOX_USERNAME'],
password: ENV['PAYPAL_SANDBOX_CLI_ID'],
signature: ENV['PAYPAL_SANDBOX_SECRET']
)
elsif Rails.env.production?
Rails.logger.info "Paypal SETUP PRODUCTION"
Paypal::Express::Request.new(
username: ENV['PAYPAL_USERNAME'],
password: ENV['PAYPAL_CLI_ID'],
signature: ENV['PAYPAL_SECRET']
)
end
And yes the logger "Paypal SETUP PRODUCTION" appear and the value set are the good one from the ENV variables.
I had to put Paypal.sandbox! in the config/development.rb to make it work for the sandbox but I cannot find a way to make it work for the production...
Any help is welcome. Thank you very much.
I have display the error, it look like that:
ERROR IS: #<Paypal::Exception::APIError::Response:0x007fa61661e040
#raw={
:TIMESTAMP=>"2015-05-24T15:01:30Z",
:CORRELATIONID=>"f3067f049ad",
:ACK=>"Failure",
:VERSION=>"88.0",
:BUILD=>"1675131",
:L_ERRORCODE0=>"10002",
:L_SHORTMESSAGE0=>"Security error",
:L_LONGMESSAGE0=>"Security header is not valid",
:L_SEVERITYCODE0=>"Error"},
#ack="Failure", #build="16751317", #correlation_id="f3067f049a", #timestamp="2015-05-24T15:01:30Z", #version="88.0", #order_time=nil, #pending_reason=nil, #payment_status=nil, #payment_type=nil, #reason_code=nil, #transaction_type=nil,
#error_code="10002",
#severity_code="Error",
#long_message="Security header is not valid",
#short_message="Security error"
Have a detailed look at the exception you're getting.
According to https://github.com/nov/paypal-express/blob/master/lib/paypal/exception/api_error.rb the error should have more useful information from the API response.
Simply catch the exception, and print it's contents:
begin
response = request.setup...
rescue Paypal::Exception::APIError => error
puts error.inspect
raise error
end
You're probably missing some configuration in your PayPal account. The detailed error message and error code should point you in the right direction.
Ok I have finally found my mistake.
It appear, you shouldn't use the CLI ID, PWD and SIGNATURE from the "live page" on your application.
But instead:
Log in to PayPal.com
You must have a PayPal Business account to make calls to the live PayPal servers. Log in to your Business account on the following page: https://www.paypal.com.
Navigate to the API Access page
Click the Tools tab and navigate to Manage your business > API Access.
Here you go, those are the good one...
Very confusing !
Hope it helps
First, double check that the 2 sets of credentials are different. You need a different account for sandbox than production.
PAYPAL_SANDBOX_USERNAME != PAYPAL_USERNAME
PAYPAL_SANDBOX_CLI_ID != PAYPAL_CLI_ID
PAYPAL_SANDBOX_SECRET != PAYPAL_SECRET
Second, double check that the production credentials are correct, i.e. no extra characters or typos.

error 16550 : "not authorized for query on " mongolab

I have a Rails application running on heroku and i am connecting at two dbs hosted in mongolab (X and Y).
I have configured two heroku env variables containing the connection strings.
When i query on Y all works fine but when i query on X db it gives me the error 16550 : "not authorized for query on X.table".
I have setted up correctly both env variables for these connections and also have a valid user to access X db.
If i connect with the shell all works fine.
How can i solve this?
Here is the error message in rails:
{"status":"500",
"error":"The operation: #<Moped::Protocol::Query\n #length=88\n #request_id=4\n #response_to=0\n
#op_code=2004\n #flags=[:slave_ok]\n
#full_collection_name=\"X.table\"\n
#skip=0\n #limit=0\n
#selector={\"_id\"=>\"5252c92521e4af681a000002\"}\n
#fields=nil>\n
failed with error 16550: \"not authorized for query on X.table\"\n\n
See https://github.com/mongodb/mongo/blob/master/docs/errors.md\nfor details about this error."}
I solved this, if someone comes here with the same problem : look at your table model, if as in my case it is "stored_in" another database you must specify there the session of the the uri = evn variables on datbase.yml

Resources