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

Cannot initialize project - An error occurred while requesting the API #18

Open
AndreasScharfCPB opened this issue Jun 28, 2023 · 3 comments

Comments

@AndreasScharfCPB
Copy link

Hi,
when I start the docker container from fresh (doesn't matter if its sqlite or posgres) everything seems to work fine.
But calling the admin console gives a warning:
"An error occurred while rewuesting the API"
and then the loading spinner never terminates .

In the containers log there is no error or warning.
In the browser console I see:
Content Security Policy: The page’s settings blocked the loading of a resource at http://localhost:1337/admin/project-type (“connect-src”).
Content Security Policy: The page’s settings blocked the loading of a resource at http://localhost:1337/admin/init (“connect-src”).

@AndreasScharfCPB
Copy link
Author

It seems wrong that the browser tries to reach out to localhost. So somewhere strapi does not know its own base_href

@oll1
Copy link

oll1 commented Jul 1, 2023

Fixed it by setting a host (https://docs.strapi.io/dev-docs/configurations/admin-panel#available-options) in config/admin.js and rebuilding the admin-panel with "yarn build". Restart your container and all should be working.

Edit: Best would be setting a env-variable to keep it update-safe

@AndiVogt
Copy link

AndiVogt commented Feb 25, 2024

I have the same Issue, but I dont know what to add to my host env. how can I change the config/admin.js, when I only pulled the docker image ?

@AndreasScharfCPB AndreasScharfCPB changed the title Cannot initialize project - An error occurred while rewuesting the API Cannot initialize project - An error occurred while requesting the API Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants