Problems connecting into my project

Feature(s) impacted

The name for my project is Medicamente APP
The problem is that I can’t log in into my project, I got this error:
error

Observed behavior

I saw that I got this error after I tried to deploy and tried to change the url of the project.

Expected behavior

I want to make it work again and maybe to find out what I couldn’t deploy, after the first one is working

Failure Logs

Here is a screenshot with what I get in Console:

Context

I made some modifications into my project url because I couldn’t deploy from Heroku what changes I’ve made, and after that I realized that I can’t no more to get into my project.

Hello @mileadavid,

Thank you for your question and welcome to the ForestAdmin community.

First, I see both “Medicament APP” and “Medicamente App” (lower case “pp”) in our internal project list.
Could you confirm that we are talking about the “APP” (upper case) project?

May I suggest that you delete the other one if not used or created by mistake?

Regarding the connection issue, you mentioned that you changed the project URL.
Could you:

  • try to directly access the URL you set, to verify that it is accessible
  • access the project settings to ensure that the project address is the same

You can access the project settings from the project list. Just pass you mouse over the right project, click the three dots icon appearing on the left, click settings, and then the “environments” tab.

Then, when trying to access you project, you should see a request to your project URL in the network tab of your developer tools.
Would you mind sharing with us the content of the request/response for this?

Thank you

1 Like

Hello and thank you for your answer! So the link that I added for the project is a local link , 'http://localhost:3000/meds . When I try to acces the link, it’s working 'cause my local is turned on.
This is what I get when I try to acces my project

@mileadavid,

Could you please open your secret.yml file and check the value for appliction_url?
There might be an inconsistency between what is configured in it and the URL you entered in the project settings.
You may need to append the /meds suffix.

1 Like

So I observed that I had the link: https://minipharma-api.herokuapp.com/meds which is the one that I wanted to deploy to, I changed it to localhost:…/meds but it seems that I have the same error.

Also, I saw that i get this error too, when I try to open my project
usererror

Hello @mileadavid,

Do you mind sharing your CORS configuration if any? Also when I try to access the url:

I have a 404 not found error. What’s your current APPLICATION_URL? It should not be localhost in this case.

Let me know if it helps

1 Like

Hello! So, in the very first begging I had the link with the localhost for my forest application. When I wanted to deploy I couldn’t even if I added the configs. After that, I changed the link for the application_url into this one: https://minipharma-api.herokuapp.com/meds, where I wanted my changes to be deployed to. Right now, the link in secrets.yml is https://minipharma-api.herokuapp.com/meds, and in the forest app, the same. Can you help me to find out what can I do to fix it? I also added a screenshot with the error that I get but I feel that I got in kinda’ infinite loop… I don’t know what can I do to make it work properly…

Thanks for your answer,

Can you share the request failing from the network tab of your browser developer tool ? I would need the two following things:

  • The request headers
  • The response headers

It seems that your request fail because of CORS configuration, have you done something that could explain this cors behavior ?

Thanks,
Louis

So the Response header is:
Cache-Control: max-age=0, private, must-revalidate Connection: keep-alive Content-Type: application/json; charset=utf-8 Date: Tue, 14 Dec 2021 16:38:09 GMT Etag: W/"cc6bdefd49fdec5cf57b0bca138bdffc" Referrer-Policy: strict-origin-when-cross-origin Server: Cowboy Transfer-Encoding: chunked Via: 1.1 vegur X-Content-Type-Options: nosniff X-Download-Options: noopen X-Frame-Options: SAMEORIGIN X-Permitted-Cross-Domain-Policies: none X-Request-Id: e4951026-d91a-4fac-ac51-e6c767ab2905 X-Runtime: 0.329628 X-Xss-Protection: 1; mode=block and the request header is:
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9,ro;q=0.8,it;q=0.7,de;q=0.6,da;q=0.5,sv;q=0.4,fi;q=0.3,es;q=0.2,pt;q=0.1 Cache-Control: no-cache Connection: keep-alive Host: minipharma-api.herokuapp.com Pragma: no-cache sec-ch-ua: "Google Chrome";v="89", "Chromium";v="89", ";Not A Brand";v="99" sec-ch-ua-mobile: ?0 Sec-Fetch-Dest: document Sec-Fetch-Mode: navigate Sec-Fetch-Site: none Sec-Fetch-User: ?1 Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36.

I can’t remember any changes into cors configuration. Is there another way that can speed up this process? Maybe got in a call or something like that… it’s very hard for me like this cause i’m also working and i need the admin interface for a project

Hard to say what is happening at the moment.

But it seems to be a misconfiguration for CORS as the message mention: No ‘Access-Control-Allow-Origin’ is present on the requested resource.

I found this thread that can help you as he had a similar issue to connect to his Forest Admin

It’s also hard to read, maybe a screenshot of the failing request should be easier to read, can you share one? Also, does the failing request as an associated response, if so, could you share it?

Another hint that can help: I can see that you set the following application url:

Can you try to remove the meds and tell me if the error is still the same ?

Last but not least, is it the OPTIONS request that is failing or the other one ?

Let me know if it helps,
Kind regards,

Louis

Can we get into a screen sharing session please? I added the link for the forest-admin in cors but still not working, and yes, the failing it’s in the options request… i don’t think that removing /meds it’s a good ideea 'cause the link without the /meds it’s not working… this error happened when i tried many times to deploy my changes… this could work better if i delete this project and create a new one from scratch? I’m under pressure with the time… this is the error in the console with the cors

Hello @mileadavid,

Can you share with me your CORS_CONFIGURATION from you application?

It should be something like:

config.middleware.insert_before 0, Rack::Cors do
      allow do
        hostnames = [null_regex, 'app.forestadmin.com']
        hostnames += ENV['CORS_ORIGINS'].split(',') if ENV['CORS_ORIGINS']

        origins hostnames
        resource '*',
                 headers: :any,
                 methods: :any,
                 expose: ['Content-Disposition'],
                 credentials: true
      end
    end

Kind regards,
Louis

Hello! I have this on cors
cors_ss
can we get into a call to solve this problem quicker?

Hello @mileadavid,

It won’t be possible to have call as long as the purpose of this forum is to help other having similar issue.

Your cors configuration seems ok, I’m pretty sure the issue come from your APPLICATION_URL. When the app try to reach your backend you get a 404 which lead to a not found error. You should try with this one:

Normally you should have a different response code than 404 on the /authentication call. If the problem persists it means that the application is calling the wrong route.

Let me know if it helps,
Kind regards,
Louis

Hello!
The fact is that for the heroku app (after the deploy) i have this link : https://minipharma-api.herokuapp.com, but the link where all the meds are is here https://minipharma-api.herokuapp.com/meds… There could be an easier way to start a new project in forest admin and to add directly the heroku url? In my main app i do a get request to get my data from the json.

Yes I think it could be easier,

I understand but you don’t need to specify specific endpoint because the request are directly done to your database. Specifiying /meds should break the authentication part of forestadmin as it try to reach /forest/authentication :slight_smile:

Kind regards,

And how can i change that? I’ve made the change in the secrets.yml file and also on the environment of the project. Now I’m not getting a 404 error anymore, just the CORS one, and I saw that you’re right 'cause when i tried to acces the link with the /forest/authentication it’s only working if i remove meds

Should i add another forest_auth_secret and forest_env_secret?