realm / realm-js

Realm is a mobile database: an alternative to SQLite & key-value stores
https://realm.io
Apache License 2.0
5.62k stars 558 forks source link

error when making call request to functions on realm #6559

Open reece-barker opened 2 months ago

reece-barker commented 2 months ago

How frequently does the bug occur?

-- select --

Description

I have had this issue pop up quite a lot of the time, I am not sure quite how to solve it, my issue is that no matter what I do in terms of realm does it ever go away, it got to the point now that I am considering just throwing the error instead of having it stop the program.

I really do not have much more info on the issue, I am very stumped myself, nothing on Stack Overflow or here and a quick google search as proven to show nothing for this specific issue.

I REALLY hope its a simple fix and I am just dumb!

Any ideas as to how I can fix this?

Stacktrace & log output

[error] App: call_function: find service_name: mongodb-atlas -> 0 ERROR: request to https://realm.mongodb.com/api/client/v2.0/app/abmts-ctrje/functions/call failed, reason: fetch failed
/Users/reece_barker/Documents/GitHub/Advanced-BattleMetrics-Ticket-System/node_modules/realm/dist/app-services/NetworkTransport.js:51
            callback({ httpStatusCode: 0, headers: {}, customStatusCode: -1, body });
            ^

Error: request to https://realm.mongodb.com/api/client/v2.0/app/abmts-ctrje/functions/call failed, reason: fetch failed
    at /Users/reece_barker/Documents/GitHub/Advanced-BattleMetrics-Ticket-System/node_modules/realm/dist/app-services/NetworkTransport.js:51:13
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 4000
}

Node.js v20.11.1

Can you reproduce the bug?

-- select --

Reproduction Steps

No way to reproduce it, at least not that I can find, here is the login for realm:

const realm = Realm.App.getApp(config.options.mongodb.realm._id);

let user = await realm.logIn(
    Realm.Credentials.emailPassword(
        config.options.mongodb.realm.username,
        config.options.mongodb.realm.password
    )
);

bot.realm = user.mongoClient(config.options.mongodb.realm._atlas);

Then I make a call like this:

    const tickets = await bot.realm
        .db(bot.config.options.mongodb.realm.db)
        .collection("tickets")
        .find({
            isPending: false,
        });

Version

^12.5.0

What services are you using?

Atlas App Services: Functions or GraphQL or DataAPI etc

Are you using encryption?

No

Platform OS and version(s)

Mac Monterey 12.7.3

Build environment

N/A

Cocoapods version

N/A

sync-by-unito[bot] commented 2 months ago

➤ PM Bot commented:

Jira ticket: RJS-2763

kneth commented 2 months ago

@reece-barker Can you check which version you have installed (^12.5.0 might have installed a recent version). I am asking for two reasons

  1. From v12.6.0 we require MacOS 10.13 or newer
  2. In v12.6.1 we moved away from Rollup, and it might have a negative impact on Fetch.