Deploy Strapi web application

The silte - https://63fb6f1fe2abea782a935e05–netlify-strapi.netlify.app/

Github source - https://github.com/rustkas/netlify-strapi
PLEASE help us help you by writing a good post!

While rendering deployed files provides strange console errors:

The script from “https://63fb6f1fe2abea782a935e05--netlify-strapi.netlify.app/admin/main.67200bb9.js” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type. 63fb6f1fe2abea782a935e05–netlify-strapi.netlify.app
The script from “https://63fb6f1fe2abea782a935e05--netlify-strapi.netlify.app/admin/runtime~main.1b45df3f.js” was loaded even though its MIME type (“text/html”) is not a valid JavaScript MIME type. 63fb6f1fe2abea782a935e05–netlify-strapi.netlify.app
Uncaught SyntaxError: expected expression, got ‘<’ runtime~main.1b45df3f.js:1
Uncaught SyntaxError: expected expression, got ‘<’ main.67200bb9.js:1

How to tune Netlify deploy setting to get current result (with web application content as local version provides)?

Netlify cannot run/host Strapi. It needs a Node.js server as far as I’m aware.

Netlify can run/host Strapi.
There is plugin to deploy - strapi-plugin-netlify-deployments.
Thre is netlify cli which has option to deploy.
After Github pull request Netlify automatically make deploy.

Netlify of course use Node.js server capabilities.

Could you point me to the source of your information?

That doesn’t deploy Strapi to Netlify, it allows your to trigger deploys to your Netlify site (that doesn’t host Strapi) connected to your Strapi instance.

Deploying Strapi is not included/possible.

Irrelevant in this context.

Incorrect. Netlify uses Node.js to run your site builds, not to host your application.

I would like just use Netlify functionality.

How to setup deploy to Netlify properly?

Hi, @java1cprog. It looks like the issue is with the location of the deployed files.

I’m seeing 404s for URLs with paths like this:

/admin/runtime~main.78dfcead.js
/admin/main.ba3b8f64.js 

Those files don’t exist under the directory /admin. The correct paths for those two files are below (without the preceeding /admin):

/runtime~main.78dfcead.js
/main.ba3b8f64.js 

This can be confirmed by downloading the deploy.

I don’t know why the HTML is adding /admin to the paths. However, I would recommend finding the cause and fixing that first as it appears this is currently the blocker preventing the site from working as required.

/admin is virtual router of that SPA. Are there project example of successful deploying Strapi project to Netlify? Where to find it?

Can I get payed consultation for that topic?

Hi, @java1cprog.

Are there project example of successful deploying Strapi project to Netlify? Where to find it?

There are two different blog posts about Strapi here:

Can I get payed consultation for that topic?

Yes, but not from Netlify. There are numerous resources for that paid consultation. You can contract with individual web developers or with a web development agency.

Netlify is not a web development agency. We do not provide consulting for the code your write or the code written by third-parties. Our support team will provide troubleshooting for the services we provide and the code written by our developers. Custom or third-party code is not included in the scope of support.

You are welcome to ask here about this /admin path issue and someone else might be able to assist you. However, asking on a Strapi specific support forum might result in a faster answer.

Thank you very much for your assistance.

I hop I get useful suggestion here (I try).

I have got Strapi quick start project. Using netlify CLI I check Netlify deploy locally. All work correctly. I like it I would like using Netlify.
But when I deploy to my Netlify account that Strapi project do not work at all.

It would be nice if someone try to get latest version of Strapi and try to deploy that project to Netlify.
If for you will be ok. Please describe step by step what you to do to archive that success deploy.
Waiting to help with that.

Unfortunately that articles do not relevant - they do not describe simple way how to work Strapi with Netlify.
Simple way is:
1.Make Strapi quickstart project.
2.Push it to Github.
3.Connect it to new Netlify project.
4.Deploy Strapi project to Netlify remove system.

I hope someone do this simple thing with me and we together (maybe) write very useful article about our success deploy.

Hi @java1cprog we do not support this web application.

Ok. I see. Of course you are not support Strapi as web application. I do not write about that at all.
This question about integration. Netlify is integrated with Strapi. There is plugin for integration. Strapi successful deploy to Netlify. There are other option to deploy to Netlify too. But while starting Strapi web application (at Netlify side) remotely something wrong happens.

The question about how to escape that.

Please, if you can’t write anything useful, please, please don’t write anything.

I hope that there will be someone on this forum who understands this issue more than I do.

I am no longer interested in this question, since I came up with a different solution - without using both Netlify and Strapi.

Hi, @java1cprog. This is not a question about Netlify. You are asking a question about your own code and we will not debug the code you write.

Again, debugging the code you write isn’t covered in the scope of our support.

This is your deployed HTML:

<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="mobile-web-app-capable" content="yes"/><title>Strapi Admin</title><script defer="defer" src="/admin/runtime~main.78dfcead.js"></script><script defer="defer" src="/admin/main.ba3b8f64.js"></script></head><body><div style="min-height:100%" id="app"></div></body></html>

The issue is in these two script tags:

<script defer="defer" src="/admin/runtime~main.78dfcead.js"></script>
<script defer="defer" src="/admin/main.ba3b8f64.js"></script>

The issue is that /admin/ is added to both src attributes above. The correct tags are these:

<script defer="defer" src="/runtime~main.78dfcead.js"></script>
<script defer="defer" src="/main.ba3b8f64.js"></script>

I know with 100% certainty that Netlify isn’t causing this. I know this because your repo is public and I can test the build command outside of Netlify. What I find is this:

  • Even when Netlify is not used the HTML generated is incorrect.

I didn’t use Netlify’s build system. I didn’t deploy to Netlify. I just ran the build command on a VM and I get the same output - with zero Netlify code used. This proves that the bug is in your repo’s code. That isn’t anything Netlify will fix for you. You need to fix that code.

About this:

This is your code, not Netlify’s code. You need to answer that question above because it is about your code.

About this:

We are telling you something useful. We are telling you that this is your job to fix and that you are asking the wrong people this question. We are not here to debug your code. We are here to provide technical support for Netlify and our services. Your question isn’t about Netlify. Your question is about your code.

You are deploying that code to Netlify successfully. The code you deployed has a bug in it and Netlify doesn’t cause that bug.

All questions about how to deploy are answered. The only unanswered question is: “How does one remove the /admin string from the <script> tags?”. That is never Netlify’s responsibility to answer as we didn’t write the code with that bug.

Ok. I see. I understand you. But this console message just a side effect. My question is the last sentence of the post.

About this project.
This deployed code is just empty Strapi quick-start. Nothing special. I understand that console message claiming routing issue. Problem is not here.
All files project files are in one folder.

Pay attention about that -
Locally Netlify CLI launches that web application correctly. All routing provides content.
I launch this build file using netlify dev. All routing works currently. Not problem with /admin/ or other routing at all.

Launching Strapi web application while netlify deploy console print issue related to routing but only for deployed version of the some project. I think may be set Netlify system variable do not setup properly for remote deploy or maybe need figure out with netlify.toml.

My question for developers how has successful integration experience with remote Netlify deploy.

If you have such experience and may be understand how Netlify system work remotely and you maybe know answer for my question. I asked about that.