Closed bac95ts closed 1 month ago
➤ PM Bot commented:
Jira ticket: RJS-2857
in file .../node_modules/realm/dist/ClassMap.js . I add comments as follows:
if (typeof arg === "string") {
console.log(`Log 1 arg: ${arg}`);
const mappingKeys = Object.keys(this.mapping);
console.log(`Log 2 this.mapping.keys: ${JSON.stringify(mappingKeys)}`);
const constructor = this.mapping[arg];
if (!constructor) {
throw new Error(`Object type '${arg}' not found in schema.`);
}
return constructor;
}
After updating bundle code push:
Log 1 arg: l
Log 2 this.mapping.keys: ["UserEntity",...]
Error: Object type 'l' not found in schema
I think the problem is minify/obfuscator bundle Code Push process
I found the cause of this error, this configuration solved my problem. In metro.config.js
, add minifierConfig
like below:
// metro.config.js
const { getDefaultConfig } = require('metro-config');
module.exports = (async () => {
const {
resolver: { sourceExts, assetExts },
} = await getDefaultConfig();
return {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: true,
},
}),
minifierConfig: {
mangle: {
// Keep the names of the schemas to avoid errors
keep_classnames: true,
keep_fnames: true,
},
output: {
comments: false,
},
},
},
resolver: {
sourceExts: [...sourceExts, 'cjs'],
},
};
})();
@bac95ts happy this got resoved! Thanks for updating the issue 👍
How frequently does the bug occur?
Always
Description
When updating the app release via CodePush on App Center, I encounter the error 'object type 'f' not found in schema'. This error does not occur when updating the app through TestFlight or the App Store. After updating bundle js from code push I see (use source map):
stack:
Has anyone experienced a similar issue or can provide assistance?
Stacktrace & log output
Can you reproduce the bug?
Always
Reproduction Steps
No response
Version
"realm": 12.6.2
What services are you using?
Local Database only
Are you using encryption?
No
Platform OS and version(s)
ios
Build environment
Which release for React Native: ..
Cocoapods version
1.15.2