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

Can't add items without images to the cart #203

Closed
bandieramonte opened this issue May 8, 2022 · 0 comments
Closed

Can't add items without images to the cart #203

bandieramonte opened this issue May 8, 2022 · 0 comments
Labels

Comments

@bandieramonte
Copy link
Contributor

Summary

When browsing the product details for a certain item which has no media images attached to it, and clicking on the "Add to cart" button, I would expect the item to be added to the cart and to be able to see the checkout screen with such item added to the cart.

What actually happens upon clicking such button, is that the site crashes showing the following error:
Unhandled Runtime Error
Error: Image is missing required "src" property. Make sure you pass "src" in props to the next/image component. Received: {}

Steps to reproduce

  1. Add a product in the Dashboard without attaching any media images to it.
  2. Go to the product details page for such product.
  3. Click the "Add to cart" button.
  4. The site crashes

A link to a reproduction repository

No response

What OS are you using?

Windows

Your next.config.js file

`next.config.js`
const withBundleAnalyzer = require("@next/bundle-analyzer")({
  enabled: process.env.ANALYZE === "true",
});

const apiURL = new URL(process.env.NEXT_PUBLIC_API_URI);
const allowedImageDomains = process.env.NEXT_PUBLIC_ALLOWED_IMAGE_DOMAINS
  ? process.env.NEXT_PUBLIC_ALLOWED_IMAGE_DOMAINS.split(",")
  : [];
const imageConversionFormats = process.env.NEXT_PUBLIC_IMAGE_CONVERSION_FORMATS
  ? process.env.NEXT_PUBLIC_IMAGE_CONVERSION_FORMATS.split(",")
  : [];

module.exports = withBundleAnalyzer({
  reactStrictMode: true,
  swcMinify: true,
  images: {
    domains: [apiURL.hostname, ...allowedImageDomains],
    formats: imageConversionFormats,
  },
  async headers() {
    return [
      {
        source: "/(.*)",
        headers: [
          {
            key: "x-content-type-options",
            value: "nosniff",
          },
          { key: "x-xss-protection", value: "1" },
          { key: "x-frame-options", value: "DENY" },
          {
            key: "strict-transport-security",
            value: "max-age=31536000; includeSubDomains",
          },
        ],
      },
    ];
  },
  experimental: {
    reactRoot: true,
  },
});

Builds logs (or link to your logs)

Build logs

Function logs

Function logs
[RuntimeError.log](https://github.com/saleor/react-storefront/files/8646837/RuntimeError.log)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants