Meteor Demo Deploy Issues

I was trying geoffreybooth/meteor-base for production deployment in app runner. It work great locally in my mac m3 machine. However, there are some issues while deploying in app runner, for reference I have attached the screenshots.

I want to deploy a simple meteor/vue v3.3 application with AWS Apprunner
The Demo Meteor app (no Vue) deploy to Apprunner. OK
The Demo Meteor/Vue app deploy to Apprunner. FAIL
The Demo Meteor/Vue app also works locally in my docker. OK

My docker image script is as below:

`# The tag here should match the Meteor version of your app, per .meteor/release
FROM geoffreybooth/meteor-base:3.3

Copy app package.json and package-lock.json into container
COPY ./app/package*.json $APP_SOURCE_FOLDER/

RUN bash $SCRIPTS_FOLDER/build-app-npm-dependencies.sh

Copy app source into container
COPY ./app $APP_SOURCE_FOLDER/

RUN bash $SCRIPTS_FOLDER/build-meteor-bundle.sh

Use the specific version of Node expected by your Meteor release, per https://docs.meteor.com/changelog.html; this is expected for Meteor 3.1.2
Use platform-specific image for AWS App Runner (x86_64)
FROM --platform=linux/amd64 node:22.16.0-alpine

RMS: this line is optional, but it’s a good idea to have it
ENV APP_SOURCE_FOLDER=/opt/src

ENV APP_BUNDLE_FOLDER=/opt/bundle
ENV SCRIPTS_FOLDER=/docker

Runtime dependencies; if your dependencies need compilation (native modules such as bcrypt) or you are using Meteor <1.8.1, use app-with-native-dependencies.dockerfile instead
RUN apk --no-cache add
bash
ca-certificates

Copy in entrypoint
COPY --from=0 $SCRIPTS_FOLDER $SCRIPTS_FOLDER/

RMS: this line is optional, but it’s a good idea to have it
COPY --from=0 $APP_SOURCE_FOLDER $APP_SOURCE_FOLDER/

Copy in app bundle
COPY --from=0 $APP_BUNDLE_FOLDER/bundle $APP_BUNDLE_FOLDER/bundle/

RUN bash $SCRIPTS_FOLDER/build-meteor-npm-dependencies.sh

Start app
ENTRYPOINT [“/docker/entrypoint.sh”]

CMD [“node”, “main.js”]`

Do you have the complete output log from Apprunner?

Appreciate for your quick response. Yes I do have. The following is complete log:

[
  "Connecting to MongoDB...",
  "(node:7) [MONGODB DRIVER] Warning: Warning: no saslprep library specified. Passwords will not be sanitized",
  "(Use `node --trace-warnings ...` to show where the warning was created)",
  "Successfully connected to MongoDB",
  "Starting app...",
  "⚡   Starting Vite server...",
  "packages/core-runtime.js:189",
  "            throw error;",
  "            ^",
  "MeteorViteError: ",
  "⚡  Unable to locate Meteor-Vite workers! Make sure you've installed the 'meteor-vite' npm package.",
  " L Install it by running the following command:",
  " L $  npm i -D meteor-vite",
  "    at createWorkerFork (packages/jorgenvatle:vite-bundler/src/workers.ts:18:15)",
  "    at module.wrapAsync.self (packages/jorgenvatle:vite-bundler/src/vite-server.ts:37:24)",
  "    at Module.wrapAsync (/opt/bundle/bundle/programs/server/npm/node_modules/meteor/modules/node_modules/@meteorjs/reify/lib/runtime/index.js:252:8)",
  "    at module (/opt/bundle/bundle/programs/server/packages/jorgenvatle_vite-bundler.js:26:9)",
  "    at fileEvaluate (packages/modules-runtime.js:335:7)",
  "    at Module.require (packages/modules-runtime.js:237:14)",
  "    at Module.mod.require (/opt/bundle/bundle/programs/server/npm/node_modules/meteor/modules/node_modules/@meteorjs/reify/lib/runtime/index.js:30:33)",
  "    at Object.require (packages/modules-runtime.js:257:21)",
  "    at evaluateNextModule (packages/core-runtime.js:167:26)",
  "    at runEagerModules (packages/core-runtime.js:206:3)",
  "    at processNext (packages/core-runtime.js:128:3)",
  "    at packages/core-runtime.js:138:5",
  "    at runEagerModules (packages/core-runtime.js:144:12)",
  "    at processNext (packages/core-runtime.js:128:3)",
  "    at packages/core-runtime.js:138:5",
  "    at evaluateNextModule (packages/core-runtime.js:163:14)",
  "Node.js v22.16.0",
  "Connecting to MongoDB...",
  "(node:7) [MONGODB DRIVER] Warning: Warning: no saslprep library specified. Passwords will not be sanitized",
  "(Use `node --trace-warnings ...` to show where the warning was created)",
  "Successfully connected to MongoDB",
  "Starting app...",
  "⚡   Starting Vite server...",
  "packages/core-runtime.js:189",
  "            throw error;",
  "            ^",
  "MeteorViteError: ",
  "⚡  Unable to locate Meteor-Vite workers! Make sure you've installed the 'meteor-vite' npm package.",
  " L Install it by running the following command:",
  " L $  npm i -D meteor-vite",
  "    at createWorkerFork (packages/jorgenvatle:vite-bundler/src/workers.ts:18:15)",
  "    at module.wrapAsync.self (packages/jorgenvatle:vite-bundler/src/vite-server.ts:37:24)",
  "    at Module.wrapAsync (/opt/bundle/bundle/programs/server/npm/node_modules/meteor/modules/node_modules/@meteorjs/reify/lib/runtime/index.js:252:8)",
  "    at module (/opt/bundle/bundle/programs/server/packages/jorgenvatle_vite-bundler.js:26:9)",
  "    at fileEvaluate (packages/modules-runtime.js:335:7)",
  "    at Module.require (packages/modules-runtime.js:237:14)",
  "    at Module.mod.require (/opt/bundle/bundle/programs/server/npm/node_modules/meteor/modules/node_modules/@meteorjs/reify/lib/runtime/index.js:30:33)",
  "    at Object.require (packages/modules-runtime.js:257:21)",
  "    at evaluateNextModule (packages/core-runtime.js:167:26)",
  "    at runEagerModules (packages/core-runtime.js:206:3)",
  "    at processNext (packages/core-runtime.js:128:3)",
  "    at packages/core-runtime.js:138:5",
  "    at runEagerModules (packages/core-runtime.js:144:12)",
  "    at processNext (packages/core-runtime.js:128:3)",
  "    at packages/core-runtime.js:138:5",
  "    at evaluateNextModule (packages/core-runtime.js:163:14)",
  "Node.js v22.16.0",
  "Connecting to MongoDB...",
  "(node:7) [MONGODB DRIVER] Warning: Warning: no saslprep library specified. Passwords will not be sanitized",
  "(Use `node --trace-warnings ...` to show where the warning was created)",
  "Successfully connected to MongoDB",
  "Starting app...",
  "⚡   Starting Vite server...",
  "packages/core-runtime.js:189",
  "            throw error;",
  "            ^",
  "MeteorViteError: ",
  "⚡  Unable to locate Meteor-Vite workers! Make sure you've installed the 'meteor-vite' npm package.",
  " L Install it by running the following command:",
  " L $  npm i -D meteor-vite",
  "    at createWorkerFork (packages/jorgenvatle:vite-bundler/src/workers.ts:18:15)",
  "    at module.wrapAsync.self (packages/jorgenvatle:vite-bundler/src/vite-server.ts:37:24)",
  "    at Module.wrapAsync (/opt/bundle/bundle/programs/server/npm/node_modules/meteor/modules/node_modules/@meteorjs/reify/lib/runtime/index.js:252:8)",
  "    at module (/opt/bundle/bundle/programs/server/packages/jorgenvatle_vite-bundler.js:26:9)",
  "    at fileEvaluate (packages/modules-runtime.js:335:7)",
  "    at Module.require (packages/modules-runtime.js:237:14)",
  "    at Module.mod.require (/opt/bundle/bundle/programs/server/npm/node_modules/meteor/modules/node_modules/@meteorjs/reify/lib/runtime/index.js:30:33)",
  "    at Object.require (packages/modules-runtime.js:257:21)",
  "    at evaluateNextModule (packages/core-runtime.js:167:26)",
  "    at runEagerModules (packages/core-runtime.js:206:3)",
  "    at processNext (packages/core-runtime.js:128:3)",
  "    at packages/core-runtime.js:138:5",
  "    at runEagerModules (packages/core-runtime.js:144:12)",
  "    at processNext (packages/core-runtime.js:128:3)",
  "    at packages/core-runtime.js:138:5",
  "    at evaluateNextModule (packages/core-runtime.js:163:14)",
  "Node.js v22.16.0",
  "Connecting to MongoDB...",
  "(node:7) [MONGODB DRIVER] Warning: Warning: no saslprep library specified. Passwords will not be sanitized",
  "(Use `node --trace-warnings ...` to show where the warning was created)",
  "Successfully connected to MongoDB",
  "Starting app...",
  "⚡   Starting Vite server...",
  "packages/core-runtime.js:189",
  "            throw error;",
  "            ^",
  "MeteorViteError: "
]```

The next steps are included in the error log

Looks like you might have the legacy version of jorgenvatle:vite-bundler installed? Unless you’re working on a Meteor v2 app, you can replace the package with jorgenvatle:vite which is the current modern Vite compiler package for Meteor.

I’ve added a warning message to jorgenvatle:vite-bundler about this to avoid any further confusion down the line.

jorgenvatle:vite-bundler (Meteor v2)
jorgenvatle:vite (Meteor v3)

To upgrade:

meteor remove jorgenvatle:vite-bundler
meteor add jorgenvatle:vite
meteor npm i meteor-vite@latest
1 Like

Thanks this helps to fix the issues. However, I am facing other issues the assets are not working after build.

404 assets not found, when I inspect image in browser image path is found to be /vite/img/img.jpg. My vite config is as below:

import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { meteor } from 'meteor-vite/plugin';

export default defineConfig({
  plugins: [
    vue(),
    meteor({
      clientEntry: 'imports/ui/main.js',
      serverEntry: 'server/main.js',
      enableExperimentalFeatures: true,
      stubValidation: {
        ignorePackages: ['meteor/mongo'],
      },
    }),
  ],
  optimizeDeps: {
    exclude: ['vue-meteor-tracker'],
  },
  publicDir: 'public',
});

If you could set up a repository that reproduces the issue, I’ll have a closer look at it tomorrow afternoon. :+1:

Hi Jorgenvatle,
Appreciate for your time.
As per your request, I have setup the public repo which is as follows: Could you please review why that public/img is not working with docker build.

Thanks Heaps.

1 Like

did you try to enter inside the container to check if the imgs is where it must to be?

docker exec -it <container_id> /bin/bash
> find / -type f -name "image.png" 2>/dev/null

Yes I checked it the file exists inside ./public/img folder.

Hi Jorgenvatle,
I hope you’re doing well. Did you got chance to review the repo?. I’d really appreciate any insights or guidance you might have.
Hope to hear from you soon.

Thanks

Sorry it took so long to get back to you on this.

I ran the build process in a fresh environment and was unable to reproduce the error messages you were seeing. Guessing the error was resolved?

For the missing static asset, you might have to import it explicitly within your Vue component. Unless I’m mistaken the public/ directory is handled by Meteor leading to files within being omitted from the manifest sent to Vite. Currently it’s being placed at wrong path within the final build /img/image.png instead of /vite/img/image.png.

To force Vite to have priority, moving it to /imports and importing it directly should address the issue.

<script setup>
import image from '/imports/img/image.png';
</script>

<template>
  <div>
    ...
    <img :src="image" />
    ...
  </div>
</template>

On second thought, this might be more of a limitation with the way the Meteor-Vite build plugin is structured. Static assets do have to be referenced as module imports instead of plain strings.

Either way, replacing the static <img src="/img/image.png" /> path with a module import should address the issue. :+1: