Skip to content

Instantly share code, notes, and snippets.

@macksal
Created April 12, 2024 04:37
Show Gist options
  • Save macksal/3af06a2b2fbfcb20d91205f3d5e84607 to your computer and use it in GitHub Desktop.
Save macksal/3af06a2b2fbfcb20d91205f3d5e84607 to your computer and use it in GitHub Desktop.

It seems EAS servers are having trouble accessing sqlite3.org. Maybe it's some bad config on their server, or perhaps sqlite3.org is blocking the traffic? who knows.

This is a problem because the sqlite3 pod used by expo-sqlite (https://github.com/clemensg/sqlite3pod) downloads sqlite3's source from this domain.

I have mirrored a fork of sqlite3pod which includes the sqlite3 source archived inside the repo: https://github.com/TykeeLabs/sqlite3pod-mirror

The attached config plugin overrides the location of the sqlite3 pod in the ios project's Podfile to point at this new repo. The installation no longer fails because EAS can still access github, by necessity.

No warranty is given express nor implied, use at your own peril, etc. etc.

{
// ...
plugins: [
// ...
["./sqlite3-patch.plugin"]
]
}
const fs = require("fs");
const path = require("path");
const {withDangerousMod} = require("@expo/config-plugins");
const {
mergeContents,
} = require("@expo/config-plugins/build/utils/generateCode");
async function readFileAsync(path) {
return fs.promises.readFile(path, "utf8");
}
async function saveFileAsync(path, content) {
return fs.promises.writeFile(path, content, "utf8");
}
function patchSqlite3(src) {
return mergeContents({
tag: "sqlite3-patch",
src,
newSrc: "pod 'sqlite3', :git => 'https://github.com/TykeeLabs/sqlite3pod-mirror.git', :branch => 'master'",
anchor: "use_frameworks!",
offset: 0,
comment: "#",
}).contents;
}
module.exports = function withSqlite3Patch(c) {
return withDangerousMod(c, [
"ios",
async config => {
const file = path.join(
config.modRequest.platformProjectRoot,
"Podfile",
);
const contents = await readFileAsync(file);
await saveFileAsync(file, patchSqlite3(contents));
return config;
},
]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment