Invalid replacement value issue while starting kong when custom plugins installed via luarocks

I have some custom plugins written in lua and I am trying to add them to kong using luarocks. Below are the details:

Kong Version: 3.4.0

I am running below commands to build and pack my plugins:

luarocks make kong-custom-plugins-3.4.0-0.rockspec
luarocks pack kong-custom-plugins 3.4.0-0

Below is docker file looks like:

FROM kong:3.4.0
ENV KONG_VERSION 3.4.0
ENV KONG_AMD64_SHA="9a4203174a29895d5dd71092a05b15b26ee9644e068d14d970aed28461d358fa"
ENV KONG_ARM64_SHA="b64e19216ce125039a6a832dc93bf277e05f233a91f1647b351cad3f166edd81"

USER root

RUN apt-get update && DEBIAN_FRONTEND=noninteractive \
    apt-get install -y --no-install-recommends \
    wget tar ca-certificates git libgcc1 openssl libssl-dev build-essential \
    libpcre3 libpcre3-dev perl tzdata libcap2-bin zip nettle-dev curl \
    && chown -R kong:0 /usr/local \
    && chmod -R g=u /usr/local \
    && rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get upgrade -y && rm -rf /var/lib/apt/lists/*
USER kong
COPY nginx_kong.lua /usr/local/share/lua/5.1/kong/templates/nginx_kong.lua
COPY docker-entrypoint.sh /docker-entrypoint.sh
COPY kong-custom-plugins-3.4.0-0.all.rock /kong-custom-plugins-3.4.0-0.all.rock
RUN luarocks install /kong-custom-plugins-3.4.0-0.all.rock
ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 8000 8443 8001 8444
STOPSIGNAL SIGQUIT
CMD ["kong", "start", "-v"]

Docker Image gets build successfully.

But when we run it, we get below error:

2025/02/11 11:56:55 [verbose] Kong: 3.4.0
2025/02/11 11:56:55 [verbose] no config file found at /etc/kong/kong.conf
2025/02/11 11:56:55 [verbose] no config file found at /etc/kong.conf
2025/02/11 11:56:55 [verbose] no config file, skip loading
2025/02/11 11:56:55 [verbose] prefix in use: /usr/local/kong
2025/02/11 11:56:55 [verbose] preparing nginx prefix directory at /usr/local/kong
2025/02/11 11:56:55 [verbose] SSL enabled on proxy, no custom certificate set: using default certificates
2025/02/11 11:56:55 [verbose] proxy SSL certificate found at /usr/local/kong/ssl/kong-default.crt
2025/02/11 11:56:55 [verbose] proxy SSL certificate found at /usr/local/kong/ssl/kong-default-ecdsa.crt
2025/02/11 11:56:55 [verbose] SSL enabled on admin, no custom certificate set: using default certificates
2025/02/11 11:56:55 [verbose] admin SSL certificate found at /usr/local/kong/ssl/admin-kong-default.crt
2025/02/11 11:56:55 [verbose] admin SSL certificate found at /usr/local/kong/ssl/admin-kong-default-ecdsa.crt
2025/02/11 11:56:55 [verbose] SSL enabled on admin_gui, no custom certificate set: using default certificates
2025/02/11 11:56:55 [verbose] admin_gui SSL certificate found at /usr/local/kong/ssl/admin-gui-kong-default.crt
2025/02/11 11:56:55 [verbose] admin_gui SSL certificate found at /usr/local/kong/ssl/admin-gui-kong-default-ecdsa.crt
2025/02/11 11:56:55 [verbose] generating trusted certs combined file in /usr/local/kong/.ca_combined
Error: 
/usr/local/share/lua/5.1/kong/cmd/utils/prefix_handler.lua:307: invalid replacement value (a table)
stack traceback:
	[C]: in function 'gsub'
	/usr/local/share/lua/5.1/kong/cmd/utils/prefix_handler.lua:307: in function 'compile_kong_conf'
	/usr/local/share/lua/5.1/kong/cmd/utils/prefix_handler.lua:696: in function 'prepare_prefix'
	/usr/local/share/lua/5.1/kong/cmd/start.lua:59: in function 'cmd_exec'
	/usr/local/share/lua/5.1/kong/cmd/init.lua:31: in function </usr/local/share/lua/5.1/kong/cmd/init.lua:31>
	[C]: in function 'xpcall'
	/usr/local/share/lua/5.1/kong/cmd/init.lua:31: in function </usr/local/share/lua/5.1/kong/cmd/init.lua:15>
	(command line -e):7: in function 'inline_gen'
	init_worker_by_lua:44: in function <init_worker_by_lua:43>
	[C]: in function 'xpcall'
	init_worker_by_lua:52: in function <init_worker_by_lua:50>