We have a code-zap that has been running without any problems for over more than a year. However, since the last few weeks this Zap has stared throwing an error on the following line of code:
// error: TypeError: value.toLowerCase is not a function
value.toLowerCase()
Does anyone know if anything has changed at the infrastructural level at Zapier's end that explains this error? Perhaps some nodeJS version change, or something.
My understanding is that the input to this function has also not changed. Just to re-confirm this, is there any easy way to log the value of value?
Zapier's Node.js versions do change automatically over time. Typically because the version a zap is running is using an EoL version of Node.js.
That said, I don't think such an upgrade would change the data type of an input. Something else certainly could have changed though. For debugging purposes, printing out the type of value will help show what type it is and how it changed.
If you email me (a Zapier employee) more details about the zap, I can potentially big into what could have changed on our end. The goal is to not break existing code steps, so this is an odd case.
Related
New to Rails, and looking for the 'right' way to do something that seems straight-forward, but nothing I've read about sounds quite right.
I have a Rails app on Heroku, and I've added a call to an endpoint that depends on an external system. If that call is unsuccessful there'll be some follow up needed, so I save details to the error log. I've added a notification email (to a slack room for this sort of thing) to prompt me to check the logs and follow up if it happens.
In case the endpoint gets bogged down and fails repeatedly, I want to be able to throttle the slack alert so I don't spam everyone (for example, only email the slack room if 30 min have gone by since the last time it alerted).
To do this, I imagine I need:
somewhere to save a timestamp for the last email notification for the error
whenever the error occurs, compare with that timestamp and only email slack room if the 30-min window has passed. Then update the timestamp with the new value.
What's an appropriate place to save this kind of timestamp value? I've read that global variables are the devil (and wouldn't actually work in this case), but the other options (adding database field, trying the simpleconfig gem) seem excessive/incorrect for something internal that I don't even know will happen once, let alone frequently.
Is there a lightweight way to get this done?
A popular choice would be to store it in a Redis store -- especially if you already have one set up for something else, like caching. As this is itself ephemeral data, you could even use the Rails.cache API to abstract away the detail and have this code just trust that it gets stored somewhere.
Failing that, the most straightforward solution is probably to create a tiny single-row table and store it in there: it's overkill, but doesn't involve doing anything unusual, or that would look out of place in the middle of a Rails application.
As a quick and simple solution, though, a global variable isn't out of the question: it has strong limitations, like it won't be shared across multiple server processes, and it'll go away any time the process restarts... but if those add up to a risk that you'll get, say, 4-6 notifications in an error-heavy 30 minute period -- maybe that's good enough? (It'd also give you a "reset on deploy" feature for free, so you know immediately if the problem's still occurring after you think you've fixed it.)
I'm using the VerificationController provided by Raywenderlich in several of my apps, and it's been fantastic. Totally reliable, easy to implement, and effective. It's been live in three of my apps for several months each.
However, two days ago, all three apps suddenly stopped working properly. Every purchase is now being flagged as invalid without exception, both for my live users and for my own test accounts. I've made no changes to the apps or their backends, in fact I've been moving apartments so I literally haven't touched them in a week or more. The change was instantaneous across all three apps, and I've understandably started getting complaints.
The problem seems to be in the checkReceiptSecurity() function (it's always returning NO when it needs to return YES for valid transactions), but the code inside that function is beyond my ability to comprehend. I'm hoping someone has encountered something like this, or perhaps is even experiencing it now, and knows a solution?
As far as I can tell, it seems to be happening on the second of these lines (VerificationController.m line 158).
require(signature_length > offsetof(struct signature_blob, certificate), outLabel);
require(signature_blob_ptr->version == 2, outLabel);
certificate_len = ntohl(signature_blob_ptr->cert_len);
Which are helpfully commented as "Make sure the signature blob is long enough to safely extract the version and cert_len fields, then perform a sanity check on the fields." When it hits the signature_blob_ptr line, it suddenly jumps to the end of the function, which I assume means that it failed a check having to do with the version number of some response from Apple?
Can anyone shed any light on what is happening? This is obviously devastating to my app portfolio, and I need to fix it immediately. I'll disable the verification temporarily and release an update if I have to, but I'd like to find a fix for whatever has changed...
Search for "receipt validation" at https://forums.developer.apple.com
Apparently, a certificate update just made VerificationController to stop working.
The obvious, but not quick at all, fix is to use the more recent receipt validation processing. See: https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Introduction.html#//apple_ref/doc/uid/TP40010573-CH105-SW1
As for the code above, signature_blob_ptr->version == 3 now. But putting 3 instead of 2 in the code is not a fix as the signature is not 128 bytes long anymore.
I am using IdHTTP.Post in my application to upload data to a server in the cloud. A DLL in the cloud saves the data to a SQL server database, and returns a simple message back to the application.
The uploaded data is simply a bunch of long strings uploaded in a loop (won't go into why here). Each string in the loop is pretty much always the same length.
For example:
For I:=1 to 10 do
begin
...
Reply:=IdHTTP.Post(URL,String);
...
end;
This works perfectly well 98% of the time. Sometimes, when the loop is more than 100 say, then 'Reply' will be blank. If I try again, then it works fine.
I tried various things, one of which is to add
Sleep(2000);
after each iteration of the loop, this also seems to do the trick!
So, in short, my upload seems to be tying itself into a knot every now and then when the upload is on the large size. Any recommendations as to how to handle this better than 'Sleep' would be appreciated.
I have not made any changes to the IdHTTP component from the default settings, apart from:
IdHTTP.ConnectTimeout:=5000;
IdHTTP.ReadTimeout :=5000;
I am using Delphi 2010.
Note that the string lengths are the same for each iteration, whether I am looping 10 times, or 100 times. So the string length itself does not seem to be the issue.
Update
So ignore pretty much most of what I thought was happening above. #Remy Lebeau correctly identified that the problem was that the reply was not being decoded correctly, and that is because IdHTTPOptions.[hoForceEncodeParams] was set to false.
The reason for this is outlined in a previous question:
Delphi TIdHTTP POST does not encode plus sign
#Remy, my version of Indy, as you pointed out in the old question, and in response to this one, is certainly outdated. I was a bit hesitant to install a later version as the install instructions looked a bit scary, and so I opted to encode manually instead in the meantime. This looks to have backfired, so will look at it now for sure.
At least now I know what is causing my problem.
I have a few follow up questions that you might be able to help me with:
I think I might be doing something wrong, but even if I set hoForceEncodeParams to True or False on the component, when looking at Fiddler, it doesn't always seem to be consistent in terms of the encoding going through to the server. I have only picked this up now because I'm looking at it in detail. The only way to be SURE of the encoding either way is to set it in the code right before posting, in other words ignore the setting on the component. Can this be correct, or what am I missing? This is why I understood the problem incorrectly in the first place, as the encoding was correct on the first iteration of the loop, but then inexplicably changed on the subsequent iterations.
With a IdHTTP.Get, I DO get a reply even if hoForceEncodeParams is set to false. Does this make sense?
I want to make an app which compiles Swift code, so how can I use a website named www.swiftstub.com or any similar website to retrieve the output of the code? I want my app to have a simple UITextView in which the user can type the code. If a UITextView cannot be used, what can be used?
I want my app to send the code typed to this website, and then retrieve the output back and display it. How can this be done? Thanks!
Make an app that sends text to a server.
Have the server compile this code, run it, and capture the output.
Send this output back to the app.
Have the app display the output.
This is an extreme oversimplification, there are lots of things to consider, but these are kind of the big sections of whats there to to. You need to understand very well on the app side: UI and networking, and on the server side: triggering a compilation of text, capturing that output (command line, maybe Swift or Python can help you here) and HTTP(S) responses and requests (or sockets, even harder).
This does not sound like an easy task, so you are very courageous.
Build all components locally:
App:
- write an app with a textView and a button, and on the tap of that button, save the output to a textile. This is to avoid any networking complications at this point, later, instead of saving, you would send this to a server.
Server: (just build the things on your computer)
- write some script/program that can read in that textfile that was saved.
- Then you need to compile this code (lookup 'xcrun' on google) and capture the output. Save this output to a textile. Have your app load this file and display it.
The important thing to consider is the real server machine you will run this code on later: it has to be a machine that can compile, and execute Swift code. Currently, this means it has to be an OS X machine. This is hard to find, as most servers run linux, and there is no Linux Swift compiler yet.
Getting this to work would be a proof of concept: you can capture text from the app, you can grab this text and compile it, you can capture the output of the compilation, and you can have the app read that output and display it.
Once you've got this working, you would need to find a server that can do the compilation part, and run what you build to do that. Then you would need to write some code in your app that sends an HTTP request to your server containing this text, to which your server would respond with the output of that compilation.
As I said, this is a big undertaking, with lots of difficult parts and unexpected surprises, so don't expect this to be done in a couple of weeks, it will most likely be more like over six months.
Try to find someone who has experience on programming and setting up a server, that will really help you a lot.
I am loosing my patience with "delay write failed" errors. It silently disconnects the database from the application so nothing gets saved in the database while using it. Is there a way to detect the occurrence itself so I can flash a warning ? Or perhaps monitoring the connection itself for a disconnection ? Everyone seems to miss the balloon tip from the Windows XP so I figured to flash a more visible warning that the application must be restarted. It seems Microsoft has found a way to force people to upgrade....
I suppose this could be done with a timer and constantly check connected users:
cxlabel1.Caption := IntToStr(DataModule2.ABSDatabase1.GetDBFileConnectionsCount);
But I was thinking more of checking/detecting for the occurence itself. Is there something in Delphi that can detect this?
I would like to hear your ideas on this...
Putting this as an answer because the comment length is limited.
I have seen this before. IIRC, the problem you have is that the Delayed Write Error is an OS error, it has nothing to do with your application. Windows has already told you that the write has been committed correctly to disk. You would have to try and hook into the OS errors to see when this is happening.
You need to get the network issues resolved because that's where the problem is. In our situation it was a faulty router that was causing the problem.
It's unfair to expect users to check for the error message and then handle it. They could be out at lunch when it occurs as it's not immediate. They also have no way of know what has been saved and what hasn't. It's only a matter of time before your database is corrupted.
The problem with a timer is that it might tell you everything is fine because it triggers after the network resolves the problems.
A far better approach would be to switch to a Client/Server database. You can do this by setting up your own server that listens for web service or another remote call or switch to a database that supports client/server instead of using a file based database. This will tell you immediately when there is a problem with the save of data.