Query not working in Preact on iPhone


Hi, I’m using Preact’s useState and useEffect to update a ‘Local Events’ component on this webpage using a Fauna UDF and a secret with narrowly-defined privileges. This works in Firefox on my Linux laptop, in Firefox and Safari on my MacOS laptop and in Firefox and Safari on my iPad, but fails on my iPhone in both Firefox and Safari with the message:

Unhandled Promise Rejection: Syntax Error: Unexpected Token '?'

In devtools on my laptop, I see a 200 status for a POST to db.us.fauna.com, and the correct JSON data logged by the line console.log('ret.data', ret.data), but on the iPhone only the error gets logged, and it shows 304 for a GET request.

import { useState, useEffect } from 'preact/hooks';
import { Fragment } from 'preact';
import faunadb from 'faunadb'

export default function LocalEvents() {
  const [eventArr, setEventArr] = useState([])

  useEffect(() => {
    const fetchData = async () => {
      const q = faunadb.query;
      const client = new faunadb.Client({
        secret: FAUNA_SECRET,
        domain: 'db.us.fauna.com',
      await client.query(
        .then((ret) => {
          console.log('ret.data', ret.data)
  }, []);
  return (
    <h2>Upcoming Events in the Portland Metro Area</h2>
    ... populate the local events section with some links ...

Thanks for any help on this!

Edit: I should have mentioned, this is an iPhone 6, software version 12.5.5. Also, just tested on Android and the error did not occur.

I’m sure this is not a Fauna issue. I was just wondering if it was a known issue, possibly with a workaround, but now having tested on many other systems and browsers, I’m convinced that it is specific to this iPhone 6 software version.

We are not aware of any particular issues with Preact. What browsers are you using to test on your iPhone? Or is it native?

Thanks - it’s not native, just a web app. I think it’s an issue with that specific IOS version, and nothing to do with fauna or preach. I tested with Firefox and Safari

Alright then! Thanks for the additional feedback.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.