Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with loading AKAMAI images in dev mod #68367

Open
4zuko opened this issue Jul 31, 2024 · 0 comments
Open

Issue with loading AKAMAI images in dev mod #68367

4zuko opened this issue Jul 31, 2024 · 0 comments
Labels
bug Issue was opened via the bug report template. Image (next/image) Related to Next.js Image Optimization.

Comments

@4zuko
Copy link

4zuko commented Jul 31, 2024

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/funny-glitter-28gnx5

To Reproduce

Issue in this line: https://github.com/vercel/next.js/blob/canary/packages/next/src/shared/lib/image-loader.ts#L32

I am using AKAMAI Image manager for serving the images in all environments. Image config used in next.config.js provided in CodeSandbox:

While debugging, I got following image configuration:

{
  config: {
    deviceSizes: [ 180, 264, 396, 564, 657 ],
    imageSizes: [
      16,  32,  48,  64,
      96, 128, 256, 384
    ],
    path: 'https://{akamaiDomainDev}/',
    loader: 'akamai',
    loaderFile: '',
    domains: [
       akamaiDomainDev,
       akamaiDomainProd,
    ],
    disableStaticImages: false,
    minimumCacheTTL: 60,
    formats: [ 'image/webp' ],
    dangerouslyAllowSVG: false,
    contentSecurityPolicy: "script-src 'none'; frame-src 'none'; sandbox;",
    contentDispositionType: 'inline',
    remotePatterns: [],
    unoptimized: false,
    allSizes: [
       16,  32,  48,  64,  96,
      128, 180, 256, 264, 384,
      396, 564, 657
    ]
  },
  src: 'assets/1234.jpg',
  quality: undefined,
  width: 16
}
  • Run: yarn dev

Current vs. Expected behavior

Current

  • Different behavior in dev and prod mode. Can we have a consistent behavior?
  • If the leading / is not provided in the image src in prod build then there is no issue
  • Running the app in dev mode requires leading / in image src if domains array is specified in image config
  • Otherwise, following error is being shown:
    image

Expected

  • No errors
  • Image loaded on the page
  • Consistent behavior for AKAMAI images in dev and prod mode

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.5.0: Wed May  1 20:13:18 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6030
  Available memory (MB): 18432
  Available CPU cores: 12
Binaries:
  Node: 20.15.1
  npm: 10.7.0
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 14.2.5 // Latest available version is detected (14.2.5).
  eslint-config-next: 14.2.5
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.5.4
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Image (next/image)

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

The easiest fix could be adding leading / to image src but the question is why we have inconsistency between different environments? Is it expected behavior?

@4zuko 4zuko added the bug Issue was opened via the bug report template. label Jul 31, 2024
@github-actions github-actions bot added the Image (next/image) Related to Next.js Image Optimization. label Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Image (next/image) Related to Next.js Image Optimization.
Projects
None yet
Development

No branches or pull requests

1 participant