404 Error with accessing media in Strapi sometime after uploading - mongodb

Some context:
I have Strapi deployed on Heroku successfully with a MongoDB backend, and can add/edit entries. My issue comes when I upload an image using the media library plug in. I'm able to upload an image, and have my frontend access it initially, displaying it etc. after sometime, like the next day or in an hour or so, the history of the file is present, as can be seen with this endpoint:
https://blog-back-end-green.herokuapp.com/upload/files/
However, the url endpoint to access the media doesn't work as it used to, and I get a 404 error when I follow it to the endpoint. e.g.
https://blog-back-end-green.herokuapp.com/uploads/avatarperson_32889bfac5.png
New to Strapi so any help/guidance appreciated

The docs address your question directly:
Like with project updates on Heroku, the file system doesn't support
local uploading of files as they will be wiped when Heroku "Cycles"
the dyno. This type of file system is called ephemeral, which means
the file system only lasts until the dyno is restarted (with Heroku
this happens any time you redeploy or during their regular restart
which can happen every few hours or every day).
Due to Heroku's filesystem you will need to use an upload provider
such as AWS S3, Cloudinary, or Rackspace. You can view the
documentation for installing providers here and you can see a list of
providers from both Strapi and the community on npmjs.com.

When your app runs, it consumes dyno hours of HEROKU
When your app idles (automatically, after 30 minutes of inactivity), as long as you have dyno hours, your app will be live and publicly accessible.
Generally, Authentication failures return a 401 (unauthorized) error but in some platforms, 404 error can also return.
Check Your second request does have the correct Authorization header
Check out role-permissions

Related

Wait time for Google Cloud service account role change to propagate

I am using a downloaded JSON file containing service account keys, instead of ADC, with code running on my local developer machine and communicating with live GCP Firestore.
After adding a service account to a role, in my case roles/datastore.user, do I have to do anything before it takes effect?
E.g. wait 15 minutes, redownload the JSON, restart some services, something else?
Question relates to this error in automated tests running on my machine.
Test method MyProject.Data.Repositories.FirestoreRepositoryTests.FirestoreAccountDocRepository_UpdateAsync__updates threw exception:
Grpc.Core.RpcException: Status(StatusCode="PermissionDenied", Detail="Permission denied on resource project my-project-prodlike.", DebugException="Grpc.Core.Internal.CoreErrorDetailException: {"created":"#1642697226.430711000","description":"Error received from peer ipv4:172.217.169.74:443","file":"/Users/einari/Projects/grpc/grpc/src/core/lib/surface/call.cc","file_line":1074,"grpc_message":"Permission denied on resource project my-project-prodlike.","grpc_status":7}")
Note - I'm using Contrib.Grpc.Core.M1 since I'm on new MacBook.
Note - I'm no longer using the above and now using Google's workaround GRPC lib adapter, just in case. See https://github.com/googleapis/google-cloud-dotnet/issues/7560#issuecomment-975414370.
The permission denied problem was being caused by an incorrect project name (and not permission actually being denied).
At the top of the Google Cloud Console is the name of the current project. However, that's actually just a pointless alias, the real project identifier is not displayed by default, though it is in the URL in the browser.
Of course, the error message implies it found its target resource and it denied access.
I'm so tired.

Strapi on Heroku Deploy very delayed http request

I have been working with using Strapi as my backend service and connecting it to my MongoDB Atlas instance and it is running and works. However, when I make http requests from my front-end, it takes up to 12 seconds to retrieve the response. My response is a very small JSON response (array of 3 objects with only 5 properties). However, it seems when I log into the admin portal and force the Strapi app to run, the requests are instant. I understand this may be an issue with the dynos cycling, but what solutions are there to this?
The reason you have this because of Heroku dynos basically turn-off after 30mins of inactivity. So next time when you ping the server/API, it takes some time to start again. The easiest way to go around is, have the Heroku service being pinged every x intervals (can be hour/day).
You can use services like this (http://easycron.com/) to set up a CRON to ping the Heroku service.
Hope it helps :)

Concerning Magenta 1.9. - “Invalid Form Key. Please refresh the page“

I have a problem with the Safari browser complaining about unsecure transfer when adding products to the basket and fails. So, I sat the unsecure transfer to https in configurations. That helped for Safari but now I can’t log in to the Magento admin. I get: “Invalid Form Key. Please refresh the page“.
In phpMyAdmin > core_config_data I changed the unsecure transfer back to http. That didn’t help so I deleted the whole site from the server and uploaded a one-week old backup, but I still got the same error. Finally, I have deleted the backup and uploaded the original. And of course, still have the error.
I have emptied var/session, var/cache and var/reports and flushed my own cache and deleted cookies.
I have found technical solutions as https://www.tigren.com/magento-error-invalid-form-key/, but I’m a novice and on top of that not a programmer.
Now, when I try to address the site via phpMyAdmin I get “mysqli_real_connect(): (HY000/1045): Access denied for user 'username'#'localhost' (using password: YES)”.
When everything else fails for me I can e-mail the host company to work on the server. But what to write?
Could a professional please walk me through a solution?

Azure publish website connecting database

So, I have an app that I want to deploy in azure. I was successfully able to deploy app to my azure url that I created. The Html page loads correctly, the JavaScript is working as expected. However, my data is not loading at all. When I looked in the debugger it was giving me a 500 error. I am not sure where I am going wrong. I do have my connection string in my web.config. My database is located on another server. I am not sure how to give azure access to it and then connect it to my help. Please let me know if you need more help.
[The first one is the console error][1]
[The second one is what my app looks like][2]
[My updated config][3]
[1]: https://i.stack.imgur.com/4gYhY.png
[2]: https://i.stack.imgur.com/gLtvz.png
[3]: https://i.stack.imgur.com/N5gzS.png
[error][1]
[1]: https://i.stack.imgur.com/kX4Jp.png
So, I figure out the problem. I am using a feature called Azure app service hybrid connection. In this setting I set how it should access the server on which my database is located at. Once these settings were made, I just published my app as usual and it worked and loads the data from the database.
These links helped me:
https://learn.microsoft.com/en-us/azure/app-service/app-service-hybrid-connections
https://learn.microsoft.com/en-us/azure/biztalk-services/integration-hybrid-connection-overview

Gateway Timeout when accessing Bluemix WEB IDE/Node.js logs

I am using Web IDE and want to see the log by clicking on the arrow.I can only see an empty "Untitled" page. The Node.js app is running normally. Live edit is switch off.
After some minutes:
Gateway Timeout
The proxy server did not receive a timely response from the upstream server.
Reference #1.45bf1402.1511018717.3dddb8b
I'm not for sure what Web IDE you are referring to. The only one I'm aware of is the DevOps (which works for me below):
It seems to me like this error that you posted would indicate a temporary outage. Is it still an issue?
In any case, I would advise opening a support ticket if you encounter this issue again (more details about your account would help). I think the Bluemix proxy will time out requests if they take too long.