1

I am using the HelloSign API to generate a webview for contract signing within React Native. The endpoint is as follows.

app.get('/api/contract/signcontract', Contract.viewAndSignContract);

this endpoint is hit after generating the embedlink (unrelated to issue) and it renders a skeleton index.jade and passes hellosign.open the embedlink (the URI is encoded before passing to the endpoint, hence the decoding)

exports.viewAndSignContract = function(req, res, next) {
  const embedLink = decodeURIComponent(req.query.url);
  res.render('index', {embedLink});
}

Which renders the hellosign embedded flow using hellosign.open(). This aspect you have already seen I believe and it is completely stock code. The endpoint is hit via a source url on a webview, this is react-native code but suffice to say everything is very vanilla.

<WebViewBridge
          ref="webviewbridge"
          onBridgeMessage={this.onBridgeMessage.bind(this)}
          source={{ uri: `${ROOT_URL}/api/contract/signcontract?url=${encodeURIComponent(this.props.partner.embedLink)}` }}
          style={{ flex: 1 }}
 />

The bug is that nearly every time a user opens the embedded flow there are at least 2 get requests:

This first one is occasional, not every time. Just a redirect.

"GET /api/contract/signcontract?url= HTTP/1.1" 304 - "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 10_2 like Mac OS X) AppleWebKit/602.3.12 (KHTML, like Gecko) Mobile/14C89"

These two are the issue:

"GET /api/contract/signcontract?ux_version=2?parent_url=http%3A%2F%2Flocalhost%3A3000%2Fapi%2Fcontract%2Fsigncontract&skip_domain_verification=1&client_id=ID_HIDDEN&user_culture=en_US&debug=true&js_version=1.2.5 HTTP/1.1" 304 - "http://localhost:3000/api/contract/signcontract?url=" "Mozilla/5.0 (iPhone; CPU iPhone OS 10_2 like Mac OS X) AppleWebKit/602.3.12 (KHTML, like Gecko) Mobile/14C89"

and the real bug here is this /contract/undefined though I do not understand why there are multiple GET requests on visiting one webpage.

"GET /api/contract/undefined?ux_version=2&parent_url=http%3A%2F%2Flocalhost%3A3000%2Fapi%2Fcontract%2Fsigncontract&skip_domain_verification=1&client_id=ID_HIDDEN&user_culture=en_US&debug=true&js_version=1.2.5 HTTP/1.1" 404 262 "http://localhost:3000/api/contract/signcontract?ux_version=2?parent_url=http%3A%2F%2Flocalhost%3A3000%2Fapi%2Fcontract%2Fsigncontract&skip_domain_verification=1&client_id=ID_HIDDENc&user_culture=en_US&debug=true&js_version=1.2.5" "Mozilla/5.0 (iPhone; CPU iPhone OS 10_2 like Mac OS X) AppleWebKit/602.3.12 (KHTML, like Gecko) Mobile/14C89"

These are local terminal logs however it is the same story viewing Heroku logs. There is no /contract/:params route, so I do not see how /signcontract is getting malformed and undefined. These requests always happen at the exact same timestamp, one does not consistently occur before the other, they flip flop. Id also like to mention that it does not break the entire application.

Both of these GET requests are always present however at its worst it will display Cannot GET /api/contract/undefined?rest_of_params briefly in the webview and then redirect to the real hellosign embedded flow, once in a blue moon it will not redirect and will stay at the "CANNOT GET" screen. This all seems very counterintuitive to me and I cannot pinpoint where the issue is coming from.

MaximeF
  • 4,913
  • 4
  • 37
  • 51

1 Answers1

0

It is my hope that your issue has since been resolved.

However, upon looking at this issue it seems as if the initial API call for the iFrame to generate is being called before the sign_url is being generated on the backend. Hence the reason two GET calls are being made in this case: one without the sign_url and one with the sign_url.

  1. Generate the request
  2. Generate a sign_url for the respective signature_id
  3. Pass the sign_url to the client side for the iFrame to populate

As previously mentioned, the best way to contact HelloSign support is to reach out to our API Team directly. Thanks!