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 access datas in production #3

Open
Corentin7301 opened this issue Sep 7, 2022 · 8 comments
Open

Cannot access datas in production #3

Corentin7301 opened this issue Sep 7, 2022 · 8 comments

Comments

@Corentin7301
Copy link

Cannot access Nhost datas in production on Netlify

Error messages :

In production, in the browser console, have :

  • 404 POST error : https://PRODUCTION_URL/api/_nhost/session

Tests carried out

  • With Nuxt 2 and Nhost JS SDK is working
  • With Nuxt 3 and Nhost JS SDK is working

Solution ?

I think the problem comes from that we recover the URL of the site (front-end) and not from the API.
Maybe expecting : POST https://API_URL/api/_nhost/session ?

Is working with local build but no longer works in production.

Technos / versions / config : 
- Nuxt 3 : 3.0.0-rc.8
    - ssr : false
- nuxt-nhost : ^1.1.0
@pk992
Copy link

pk992 commented Sep 7, 2022

Could it be related to ssr: false? If you generate a static build, /api/_nhost/session won't be included. This route is part of the SSR build and persists the auth session, so you can reload the page without losing it (in the SSR context).

@Corentin7301
Copy link
Author

Mmh okay... I'm not yet completely comfortable with the SSR...
What would be the solution? To pass SSR in True? What will it change?

@Corentin7301
Copy link
Author

I've test with SRR : true but I've the same error...

@pk992
Copy link

pk992 commented Sep 7, 2022

Are you using the netlify-edge or netlify nitro preset? I think you need the edge one for SSR. If you remove the nitro preset from the config and simply run yarn build and yarn preview, does it work?

For me, it currently works fine in dev and the NodeJS & Cloudflare Worker prod build.

I will try my build on Netlify this week to find the problem.

@Corentin7301
Copy link
Author

Mmh... I don't no if I used netlify-edge or nitro but I don't have change Netlify base configuration (except build & domain)

Thanks for your test build!

@Corentin7301
Copy link
Author

I will try my build on Netlify this week to find the problem.

Hi!
Were you able to test to find the problem ?

@Corentin7301
Copy link
Author

I have a solution!
I've update Nuxt to 3.0.0-rc.9 (but I don't no if is that)
I've build my app in CSR (and not static like before)

Now is working BUT the session is broken when I refresh the page...
Have you a solution?

@pk992
Copy link

pk992 commented Sep 29, 2022

Have you had a look at #2? This should be the solution, at least for now.

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

2 participants