Find solutions to common issues that you may face during app development.
Issues
I see Typescript errors
Saleor Apps, SDK and App Template use pnpm package manager. It can be sensitive to dependencies resolutions, especially in a monorepo setup.
Please ensure you have installed the right version of pnpm on your machine and re-install dependencies with pnpm install
.
To find the accurate pnpm version in your project, check the root package.json
file and look for the packageManager
field.
For example: "packageManager": "pnpm@8.2.0"
means that you need to install exactly the 8.2.0
version of pnpm.
Client-side GraphQL requests are rejected due to CORS error
If you are using the Saleor Cloud instance, you may encounter the following error when trying to make a GraphQL request from the client side:
Access to fetch at 'https://xxx.eu.saleor.cloud/' from origin 'https://your-application' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
The issue might be caused by the CORS policy set up in the Saleor Cloud dashboard. Navigate to the environment details of your instance and check the Allowed API origins
section. If option Selected origins
is selected, you have two possible solutions:
- Add your application URL to the list of allowed origins.
- Ensure your application makes GraphQL requests from the server side only.