#Why am I getting generate:importmap errors, even though it's in my repo?
60 messages · Page 1 of 1 (latest)
Help is on the way! To mark it as solved, use the /solve command. In the meantime, here are some existing threads that may help you:
Documentation:
Even if I run it at start up, I still get the error....
next build --experimental-build-mode generate && payload generate:importmap && next start
I'm regretting choosing next.js
If I don't scale payload passed 1 instance, I can try to do the full build at startup
What I don't understand is, why has no one else seen this issue?
maybe an issue with the migration?
https://payloadcms.com/docs/database/migrations
Fresh deletes the entire database - am I do to that on a production payload instance, every time I update the version? Seems incorrect.
Note: This worked fine in an older version ...
Just to make it clear - this is not a problem during development. It's only a problem during deployment.
definately not, just thought if its a dev/temp thing, you can just wipe it and see if the issue reoccurs.
My gut instinct tells me its to do with your schema not being updated/synced or something. I had a similar issue, I reset the DB, pushed schema changes and I was good again
It's definitely not a schema sync thing
The difference is an updated package.json file, with a newer version of payload in it
commit before that owrks fine. commit after that gets the error. Trying to run generate:importmap in the Dockerfile, does NOT fix it.
try lock your payload version so it doesn't change?
Why you need to do it during ci? Thats creates double sources of truth that you might want to avoid.
Can you share your package json?
I was trying to solve the above error - I shouldn't have to do that - and I didn't have to do it in older versions of payload.
I can lock my Payload version sure - this seems like it should be considered completely inappropriate advice. I want to be able to update Payload.
each version do you use?
FROM node:22-alpine AS base
ENV NEXT_TELEMETRY_DISABLED=1
ARG GIT_HASH
ARG NEXT_PUBLIC_PAYLOAD_URL
ARG NEXT_PUBLIC_SITE_URL
ARG PAYLOAD_PUBLIC_SERVER_URL
ARG NEXT_PUBLIC_DEVELOPER_SITE_URL
ARG PAYLOAD_SECRET
ARG ASSETS_URL
ENV NEXT_PUBLIC_PAYLOAD_URL=$NEXT_PUBLIC_PAYLOAD_URL
ENV NEXT_PUBLIC_SITE_URL=$NEXT_PUBLIC_SITE_URL
ENV PAYLOAD_PUBLIC_SERVER_URL=$PAYLOAD_PUBLIC_SERVER_URL
ENV NEXT_PUBLIC_DEVELOPER_SITE_URL=$NEXT_PUBLIC_DEVELOPER_SITE_URL
ENV PAYLOAD_SECRET=$PAYLOAD_SECRET
ENV ASSETS_URL=$ASSETS_URL
WORKDIR /app
COPY package.json pnpm-lock.yaml* ./
RUN npm i -g pnpm && pnpm i --frozen-lockfile --no-store-dir
COPY . .
ENV NODE_ENV=production
ENV BUILD_ID=$GIT_HASH
RUN pnpm run compile
# RUN rm -rf node_modules && pnpm install --prod --frozen-lockfile
# RUN addgroup --system --gid 1001 nodejs
# RUN adduser --system --uid 1001 nextjs
# RUN chown -R nextjs:nodejs /app
# USER nextjs
EXPOSE 3000
CMD ["npm", "run", "prod"]
It worked at least up to 3.24
Also, because of the very persnickity package version requirements, it's not super easy to change versions of payload. You have to be super careful to change the version, install deps, then run it and test that you don't have a version mismatch for packages like pg and pino - which have to exactly match internal versions, which can for some reason only be deteremined at runtime, rather than a simply dependency map.
anyone? 😄
Whats exactly the error you having?
I both have the importmap in my source code, and also re-generate it at startup (and have tried re-generating it at compile time in the build environment)..
Nothing fixes this problem.
run the importmap manually and lets see, whats the error
I don't get an error running that
I get the error when I run the build later
I can also run a build locally no problem, this only happens in deployment
If I got back to an older version, I have no problem
I wonder if something happened in the s3 plugin
maybe something changed there that I missed
I have found the errors in general with payload to be kind of baffling
you have feature flag there? In the plugin so you get it only on prod?
can you share the plugin config, how it looks like?
I do have a config flag there, yeah
can you disable it just to run the importmap manually, so we can see what the actual error
> NODE_OPTIONS=--no-deprecation payload generate\:importmap
Generating import map
No new imports found, skipping writing import map
no error when disabled, let me try it when enabled
config is dependant on defined env var
okay, well it did add something to the importMap.js file (no error)
maybe that's all I need?
I have the s3storage enable in dev because of that actually. You probably better use disabled field instead of doing this ninja check
so the error wasn't
You may need to run the `payload generate:importmap` command to generate the importMap ahead of runtime
It was more like:
A component is missing from your importmap - did you disable that for development purposes?
It's not super clear how to work around that - when running locally, I definitely don't want the S3 bucket enabled
you first of all better use disabled, so theoretically it should add all necessary field in db and importmap. Currently its not working properly
okay, that makes sense
we can walk around this by adding generator in admin importMap.generator, but i not tried it yet
enabled for plugins, disabled for fields of collections