SyntaxError: Unexpected token < in JSON at position 0

Every Time I pull the page for a new user to go through verification using the drop-in as part of my testing the following error is showing in red at the top:

SyntaxError: Unexpected token < in JSON at position 0

It’s non-blocking as once I enter the info and click accept it clears and we move on however it’s extremely unsightly and it seems to be being triggered by dwolla-web.js:

Error: SyntaxError: Unexpected token < in JSON at position 0
dwollaError @ borrowerdashboard.js:160
error @ borrowerdashboard.js:141
(anonymous) @ dwolla-web.js:formatted:1953
Promise.catch (async)
fetchToken @ dwolla-web.js:formatted:1953
fetchCreateCustomerToken @ dwolla-web.js:formatted:2988
firstUpdated @ dwolla-web.js:formatted:2947
performUpdate @ dwolla-web.js:formatted:1132
_enqueueUpdate @ dwolla-web.js:formatted:1107
async function (async)
_enqueueUpdate @ dwolla-web.js:formatted:1105
requestUpdateInternal @ dwolla-web.js:formatted:1096
initialize @ dwolla-web.js:formatted:1035
initialize @ dwolla-web.js:formatted:1375
P @ dwolla-web.js:formatted:951
be @ dwolla-web.js:formatted:1348
o @ dwolla-web.js:formatted:2916

Here are the headers on the Request:

-- GENERAL
Request URL: https://www.yourlandloans.com/borrowerdashboard
Request Method: POST
Status Code: 405 
Remote Address: 13.33.69.84:443
Referrer Policy: strict-origin-when-cross-origin
-- RESPONSE HEADERS
allow: HEAD, DELETE, GET, PUT
content-type: application/xml
date: Sun, 11 Jul 2021 08:54:29 GMT
server: AmazonS3
via: 1.1 99dbd2a3f5ac7f737ea28ce5c6a8e823.cloudfront.net (CloudFront)
x-amz-cf-id: 70xYA-s-EFdJMLoc7d_3RvOAHnYNGMD57BVC6v7Xe5rKVCLIwGTFLQ==
x-amz-cf-pop: PHX50-C1
x-amz-id-2: yPUg0PNevR6QRki5nA3MFWaXXzH0ZtAup1Te7y6DVNw55pbMQChSHUF+yTYn5ya24SZ23NsqyUI=
x-amz-request-id: Y12FP9RC03B3R90D
x-cache: Error from cloudfront
-- REQUEST HEADERS
:authority: www.yourlandloans.com
:method: POST
:path: /borrowerdashboard
:scheme: https
accept: application/json
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9
content-length: 28
content-type: application/json
origin: https://www.yourlandloans.com
referer: https://www.yourlandloans.com/borrowerdashboard
sec-ch-ua: " Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"
sec-ch-ua-mobile: ?0
sec-fetch-dest: empty
sec-fetch-mode: cors
sec-fetch-site: same-origin
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36
x-requested-with: Dwolla-Drop-Ins-Library
-- REQUEST PAYLOAD
{action: "customer.create"}

And the Response

<Error>
<Code>MethodNotAllowed</Code>
<Message>The specified method is not allowed against this resource.</Message>
<Method>POST</Method>
<ResourceType>OBJECT</ResourceType>
<RequestId>Y12FP9RC03B3R90D</RequestId>
<HostId>yPUg0PNevR6QRki5nA3MFWaXXzH0ZtAup1Te7y6DVNw55pbMQChSHUF+yTYn5ya24SZ23NsqyUI=</HostId>
</Error>

Any help in resolving this would be greatly appreciated!

Follow Up:

I was able to overcome this by moving around the load order of some of the JS on the page. Specifically I moved

<script>dwolla.configure({
    X: Y
});</script>

Up to the top to load it right after I import dwolla-web.js.

1 Like