question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`Something went wrong while processing your request.` while running a minimal demo

See original GitHub issue
  • Client version: "pocketbase": "^0.2.1",
  • Server version: pocketbase version 0.3.2
  • Client code:
    • vite
function App() {
  const [count, setCount] = useState(0);

  useEffect(() => {
    PocketBaseClient.getFeedbacks().then(feedbacks => {
      console.log(feedbacks);
    }).catch(err => {
      console.log(err);
    });
  });

import PocketBase, { Record } from "pocketbase";

const client = new PocketBase(process.env.NODE_ENV === "production" ? process.env.PB_URL : "http://localhost:8090");

export class PocketBaseClient {
  static getFeedbacks = async (): Promise<Record[]> => {
    const records = await client.Records.getFullList("feedback", 200 /* batch size */, {
      sort: "-created",
    });

    return records;
  }
}

package.json:

{
  "name": "web",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "tsc && vite build",
    "preview": "vite preview"
  },
  "dependencies": {
    "pocketbase": "^0.2.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },
  "devDependencies": {
    "@types/react": "^18.0.15",
    "@types/react-dom": "^18.0.6",
    "@vitejs/plugin-react": "^2.0.0",
    "typescript": "^4.6.4",
    "vite": "^3.0.0"
  }
}

Error stack:

ClientResponseError 0: Something went wrong while processing your request.
    at new i2 (ClientResponseError.ts:13:9)
    at Client.ts:175:23
    at async PocketBaseClient.getFeedbacks (index.ts:7:21)

The JSON response looks good:

{
  "page": 1,
  "perPage": 200,
  "totalItems": 1,
  "items": [
    {
      "@collectionId": "icxcxKTTpbM7iv9",
      "@collectionName": "feedback",
      "attachments": [
        "DsOmZWHtfBnCFAcXSQsn1RmswOykjuR0.png"
      ],
      "created": "2022-07-23 13:08:35.599",
      "email": "sdadsa@dasa.com",
      "id": "rJJTW8mAXt6uoDk",
      "metadata": {
        "foo": 1
      },
      "updated": "2022-07-23 13:08:35.599"
    }
  ]
}

Now sure why there’s such an error ?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ganigeorgievcommented, Nov 12, 2022

@CM-IV I’ve cloned your repo and it seems that it is not a cors issue (or at least not directly).

Your code currently has a side effect - when you try to submit the edit or delete form, the native form submit event is not stopped/prevented and it is causing page refresh/redirect while the fetch call is being processed. There is an open “issue” in Firefox for that in https://bugzilla.mozilla.org/show_bug.cgi?id=1280189.

To fix it, you need to prevent the native browser form behavior and leave your javascript to handle the form submission, aka. you have to add e.preventDefault() to your onSubmit handlers. Here is for example the delContact:

    async function delContact(e) {
        e.preventDefault();

        try {
            await db.collection("contacts").delete(urlId);
    
            router.back();

            router.refresh();
        } catch (err) {
            /*@ts-ignore*/
            console.log(err.originalError);
        }
    }
1reaction
ganigeorgievcommented, Nov 11, 2022

@CM-IV Hm, TypeError: NetworkError when attempting to fetch resource. is usually a CORS error and it is most likely caused because nextjs13 as far as I know uses their own custom fetch. I’ll try to find time tomorrow and will test the repo locally to see if I can reproduce it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Something went wrong while processing your request.
Something went wrong while processing your request. It shows this when we start the payment. any idea why this is happening everything merchant...
Read more >
How to Fix a 400 Bad Request Error (Causes and Fixes) - Kinsta
The 400 Bad Request error indicates that the server cannot or process the request due to a client error. Read about the common...
Read more >
Something went wrong while processing your request. Please ...
HTTP status code: 500. This morning I tried to start up a Databricks session, but I got an error: LivyHttpRequestFailure: Something went wrong ......
Read more >
reCAPTCHA Help - Google Support
Official reCAPTCHA Help Center where you can find tips and tutorials on using reCAPTCHA and other answers to frequently asked questions.
Read more >
API Errors - Vonage API Developer
When a Nexmo API returns an error, for instance, if your account has no credit, the API will return an error in RFC...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found