Next.js Discord

Discord Forum

I need help with deploying a next app to vercel which relies on submodules

Unanswered
Snowshoe posted this in #help-forum
Open in Discord
SnowshoeOP
I have a nextjs app which relies on two submodules. The three git repositories are private gitlab repositories.

I have created a npm preinstall script, which looks like this:

echo "Preinstall script running"

if [ -z "$GITLAB_ACCESS_TOKEN" ]; then
    echo "Building locally"
else
    echo "Building on vercel"
    GIT_SUBMODULE_CONTENT="""
[submodule \"scripts\"]
    path = scripts
    url = https://${GITLAB_ACCESS_TOKEN}@gitlab.com/my-group/scripts.git
[submodule \"client-themes\"]
    path = client-themes
    url = https://${GITLAB_ACCESS_TOKEN}@gitlab.com/my-group/packages/client-themes.git
"""
    echo "$GIT_SUBMODULE_CONTENT" >.gitmodules
    cat .gitmodules # *1
fi

git submodule update --remote --init --recursive
bash scripts/pipelines/npmrc/prepare_npmrc.sh

I can see then the following build output:

fatal: repository '/vercel/packages/client-themes.git' does not exist
fatal: clone of '/vercel/packages/client-themes.git' into submodule path '/vercel/path0/client-themes' failed
Failed to clone 'client-themes'. Retry scheduled
fatal: repository '/vercel/scripts.git' does not exist
fatal: clone of '/vercel/scripts.git' into submodule path '/vercel/path0/scripts' failed
Failed to clone 'scripts'. Retry scheduled
fatal: repository '/vercel/packages/client-themes.git' does not exist
fatal: clone of '/vercel/packages/client-themes.git' into submodule path '/vercel/path0/client-themes' failed
Failed to clone 'client-themes' a second time, aborting

I am confused on why the wrong url is used for checking out the repository.

Output of the cat command: *1

[submodule "scripts"]
    path = scripts
    url = https://****@gitlab.com/my-group/scripts.git
[submodule "client-themes"]
    path = client-themes
    url = https://****@gitlab.com/my-group/packages/client-themes.git

0 Replies