Comments (5)
I think itβs nothing about json_decode, but the data responded from Nylas was invalid JSON.
In Nylas's API docs, they said:
I have checked the content type from the response header, like this:
So, when it's not JSON, it will be returned directly without parsing.
And, "Unable to parse response body into JSON: 10" means that:
the "JSON_ERROR_UTF16" error occurs.
The reason is single unpaired UTF-16 surrogate in Unicode escape contained in the JSON string passed to json_encode().
I will add a new config option which can be used to control the exception throws when decoding the responded body.
After it enabled, the body content will be returned directly without parsing when the json_decode error occurs.
from nylas-php.
@robtesch try this https://github.com/lanlin/nylas-php/releases/tag/3.4.0
from nylas-php.
@lanlin awesome! Thank you! Will give it a go ASAP and let you know (probably only on Sunday).
from nylas-php.
@lanlin OK fantastic, I managed to use this config option to work around the issue of the invalid json response from nylas. Turns out it was only 1 message from 1 account that was causing the issue. I have now built a workaround where I simply request smaller and smaller batches of messages until I get only valid messages, then I increment the offset to skip the invalid message.
from nylas-php.
@robtesch That's good.
from nylas-php.
Related Issues (20)
- oauth, two parameters are not required, but yes by this lib HOT 1
- how can use Webhook? HOT 2
- Why is the tracking option always returning 403 Error? HOT 2
- Stability and maintainability of this package in large scale production environment HOT 1
- What does the error "All of the required rules must pass" means? HOT 1
- am I missing a file? HOT 1
- Is there a method for upgrade and downgrade? HOT 3
- Irish and Canadian servers HOT 3
- Sokil isocodes HOT 2
- All of the required rules must pass for HOT 3
- Support for Conference Sync - Beta HOT 1
- Make Sending::getMessgeRules() public? HOT 1
- Free/Busy API HOT 1
- Error handling for SSL expiry HOT 1
- Hosted Authentication postOAuthToken issn't working. HOT 7
- No Native Auth example in docs HOT 3
- Setting Options using $nylas->Options fails with 'class Nylas\Options\Abs not found!' exception HOT 2
- Add support for Nylas Scheduler API HOT 3
- Issue with mailbox connections / malformed requests.
- Support for more variables for Availability
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nylas-php.