Fix image urls in dev #22

Open
opened 2024-05-19 06:39:54 +00:00 by tma · 4 comments
Owner
No description provided.
tma added the
infrastructure
label 2024-05-19 06:39:54 +00:00
3wordchant referenced this issue from a commit 2024-05-19 16:01:21 +00:00
Owner

Post images now working reliably for me, thumbnails still not, how about you?

Post images now working reliably for me, thumbnails still not, how about you?
Author
Owner

Running dev script now does not work, can't connect to mongodb it seems

/docker-entrypoint.sh: line 30: MONGODB_USER: unbound variable
astroad-astro | 16:13:27 [ERROR] fetch failed
astroad-astro | Stack trace:
astroad-astro | at node:internal/deps/undici/undici:12502:13
astroad-astro | at async Module.getPosts (/base/src/utils/payload.ts:8:11)
astroad-astro | [...] See full stack trace in the browser, or rerun with --verbose.
astroad-astro | Caused by:
astroad-astro | getaddrinfo ENOTFOUND payload
astroad-astro | at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:120:26)
astroad-payload | /docker-entrypoint.sh: line 30: MONGODB_USER: unbound variable

Running dev script now does not work, can't connect to mongodb it seems /docker-entrypoint.sh: line 30: MONGODB_USER: unbound variable astroad-astro | 16:13:27 [ERROR] fetch failed astroad-astro | Stack trace: astroad-astro | at node:internal/deps/undici/undici:12502:13 astroad-astro | at async Module.getPosts (/base/src/utils/payload.ts:8:11) astroad-astro | [...] See full stack trace in the browser, or rerun with --verbose. astroad-astro | Caused by: astroad-astro | getaddrinfo ENOTFOUND payload astroad-astro | at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:120:26) astroad-payload | /docker-entrypoint.sh: line 30: MONGODB_USER: unbound variable
Owner

Ah 😖 Looks like it's trying to run the -prod container locally still? Latest commit tries to fix it... can't test locally because of spooky network error tho

Ah 😖 Looks like it's trying to run the `-prod` container locally still? Latest commit tries to fix it... can't test locally because of spooky network error tho
Author
Owner

When running the dev script the image URL is constructed differently than the build script

DEV
src="/_image?f=webp&w=150&h=150&ar=1&href=cow.gif"

PROD
src="/_astro/cow_ZPFrIy_NWQNh.webp"

Images exist in astro container

~/ws/an/astro-payload-test  t-work [$!?] +3 -2                                                           v20.12.2   20:55:40
❯ docker exec -it astroad-astro sh

/base # ls dist/
_astro/        favicon.svg    fonts/         index.html     not-found.png  posts/
/base # ls dist/_astro/
2e0c0fe6-3b30-4916-a43a-28db66919652_text-1_8avHU.webp    cow_ZPFrIy_Ziluap.webp
2e0c0fe6-3b30-4916-a43a-28db66919652_text-1_Z231D3x.webp  index.DPWfh8uI.css
cow_ZPFrIy_NWQNh.webp                                     page.CQPzDy5g.js
/base # ls dist/_astro/
2e0c0fe6-3b30-4916-a43a-28db66919652_text-1_8avHU.webp    cow_ZPFrIy_Ziluap.webp
2e0c0fe6-3b30-4916-a43a-28db66919652_text-1_Z231D3x.webp  index.DPWfh8uI.css
cow_ZPFrIy_NWQNh.webp                                     page.CQPzDy5g.js

In prod

image

In dev

image

In dev with corrected url

Screenshot from 2024-05-24 20-57-35

But why is the url different?

Don't really know, I will have to learn more about how astro builds and optimizes images. In any case I think this one is a matter of configuration in astro

When running the dev script the image URL is constructed differently than the build script **DEV** `src="/_image?f=webp&w=150&h=150&ar=1&href=cow.gif"` **PROD** `src="/_astro/cow_ZPFrIy_NWQNh.webp"` ## Images exist in astro container ``` ~/ws/an/astro-payload-test  t-work [$!?] +3 -2  v20.12.2 20:55:40 ❯ docker exec -it astroad-astro sh /base # ls dist/ _astro/ favicon.svg fonts/ index.html not-found.png posts/ /base # ls dist/_astro/ 2e0c0fe6-3b30-4916-a43a-28db66919652_text-1_8avHU.webp cow_ZPFrIy_Ziluap.webp 2e0c0fe6-3b30-4916-a43a-28db66919652_text-1_Z231D3x.webp index.DPWfh8uI.css cow_ZPFrIy_NWQNh.webp page.CQPzDy5g.js /base # ls dist/_astro/ 2e0c0fe6-3b30-4916-a43a-28db66919652_text-1_8avHU.webp cow_ZPFrIy_Ziluap.webp 2e0c0fe6-3b30-4916-a43a-28db66919652_text-1_Z231D3x.webp index.DPWfh8uI.css cow_ZPFrIy_NWQNh.webp page.CQPzDy5g.js ``` ## In prod ![image](/attachments/fa3c08f9-0f84-4a41-ac96-8772cdedf8d2) ## In dev ![image](/attachments/a14f42a9-b86b-44ed-af7b-7ef3321d00a2) ## In dev with corrected url ![Screenshot from 2024-05-24 20-57-35](/attachments/b9461c9e-4004-491f-a481-f258e8f87cae) ## But why is the url different? Don't really know, I will have to learn more about how astro builds and optimizes images. In any case I think this one is a matter of configuration in astro
tma added
astro
and removed
infrastructure
labels 2024-05-24 19:06:27 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: autonomic-cooperative/astro-payload-template#22
No description provided.