Skip to content

'cocos-ignore' is not valid enum #192

Open
@Bl4ckburn

Description

@Bl4ckburn

Hey everyone,
I am currently using nakama-js in combination with ionic (capacitor) and after upgrading the version of capacitor-android to 5.4.0 (minimum) and compile project to APK it shows an error in app from nakama (even though I don't use the cocos engine):

TYPEERROR: FAILED TO CONSTRUCT 'REQUEST': FAILED TO READ THE 'CREDENTIALS' PROPERTY FROM 'REQUESTINIT': THE PROVIDED VALUE 'COCOS-IGNORE' IS NOT A VALID ENUM VALUE OF TYPE REQUESTCREDENTIALS.

It looks as if newer versions of lib.dom block the ability to change 'credentials'. My proposal is to simply checking whether the 'credentials' property is readonly, just to start with.
I don't know how the cocos engine itself reacts to the change.

checking function:

function isWritable<T extends Object>(obj: T, key: keyof T) {
  const desc = Object.getOwnPropertyDescriptor(obj, key) || {}
  return Boolean(desc.writable)
}

and change condition line before credentials assign in buildFetchOptions function from: if (!descriptor?.set) { to if (!descriptor?.set && isWritable(fetchOptions, 'credentials')) {

I would be grateful if someone had a better idea on how to solve this problem, without cutting off the cocos engine in the future by above condition.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions