Skip to content

Images in src folder are not working in vercel branch preview with deployment protection enabled #10752

@Trombach

Description

@Trombach

Astro Info

Astro                    v4.5.18
Node                     v21.6.2
System                   Linux (x64)
Package Manager          pnpm
Output                   hybrid
Adapter                  @astrojs/vercel/serverless
Integrations             @astrojs/tailwind
                         @astrojs/svelte
                         @astrojs/mdx
                         @astrojs/react
                         adds-to-head

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

I have not fully understood the cause of this bug, but I am able to reproduce it with a minimal example. It is possible this is entirely on vercel's side but I'm hoping to gain some insight to what's causing this issue here.

It is possible that this bug is also caused under different circumstances, but this is the specific set of conditions I found (also see linked stackblitz). The project must be set to "hybrid" mode and the vercel integration must be added. On pages that are not prerendered, i.e export const prerender = false; is set, images imported won't show on vercel preview deployments when deployment protection (vercel authentication) is enabled for that environment (only alt text is shown). The network tab shows 404 responses for the image requests. Prerendered pages, local development and when deployed to vercel's production environment, everything works as expected.

When I disable vercel authentication in the project settings the 404 responses disappear.

image
image

Please let me know if this issue is entirely on Vercel's end so I can file a bug report with them.

What's the expected result?

Images should work when vercel deployment protection is active.

Link to Minimal Reproducible Example

https://stackblitz.com/~/github.com/Trombach/astro-image-test

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageIssue needs to be triagedpkg: vercelRelated to Vercel adapter (scope)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions