Skip to content
This repository has been archived by the owner on Jan 28, 2022. It is now read-only.

Cookie is not allowed #49

Closed
joshhopkins opened this issue Jan 28, 2021 · 9 comments
Closed

Cookie is not allowed #49

joshhopkins opened this issue Jan 28, 2021 · 9 comments

Comments

@joshhopkins
Copy link

When running the latest docker image, with default config COOKIE_SECURE, COOKIE_SAME_SITE, I get the following response when calling auth.login(email, password).

{"statusCode":400,"error":"Bad Request","message":"\"cookie\" is not allowed"}

Have tried both use_cookies: false and without the param:

const config = {
    base_url: process.env.REACT_APP_BACKEND_ENDPOINT,
    use_cookies: false,
}

Anything obvious I may be missing?

@Svarto
Copy link
Contributor

Svarto commented Jan 28, 2021

Are you trying to instantiate the nhost-js-sdk in the nhost custom api container? Are you self hosting HBP (is that what you mean with docker)? And which version of nhost-js-sdk?

@joshhopkins
Copy link
Author

Are you trying to instantiate the nhost-js-sdk in the nhost custom api container?

I'm not familiar with the nhost custom api container, as in this container? I'm running this image.

Are you self hosting HBP (is that what you mean with docker)?

Yes, testing locally.

And which version of nhost-js-sdk?

Latest version of nhost-js-sdk – 2.3.4.

@Svarto
Copy link
Contributor

Svarto commented Mar 4, 2021

I ran into this problem recently and got it fixed by upgrading to v3.0.0 nhost-js-sdk AND HBP v.2.2.4. Try it and maybe it works for you too?

@joshhopkins
Copy link
Author

Thanks for the update @Svarto. I'm still getting the same response after updating to nhost-js-sdk v3.0.0 + HBP v.2.2.4 (tried both docker image and source).

It doesn't seem to be related to this library as "\"cookie\" is not allowed" is thrown when calling POST /auth/login.

I had a quick look here at it appears that there something odd going on with validation. See output:

[Error [ValidationError]: "cookie" is not allowed] {
  _original: { cookie: true },
  details: [
    {
      message: '"cookie" is not allowed',
      path: [Array],
      type: 'object.unknown',
      context: [Object]
    }
  ]
}

I also tried updating to the latest version of Joi (current package has been depreciated), with no luck.

@nunopato
Copy link
Contributor

nunopato commented Mar 7, 2021

@joshhopkins if you explicitly set useCookies: false (for v3 note it is camelCase) you still get that error?

const nhostClient = createClient({
  baseURL: 'https://backend-url.nhost.app',
  useCookies: false, //defaults to false
})

@joshhopkins
Copy link
Author

Yes @nunopato – but I'm quite sure it's related to this.

@elitan
Copy link
Contributor

elitan commented Mar 8, 2021

@joshhopkins Can you just double-check your HBP version? Do you self-host or use Nhost?

If you're self-hosting and using something like image:nhost/hasura-backend-plus:latest try to do docker-compose pull so you actually have the latest version.

I tried this exact setup and everything is working for me.

@aaronhayes
Copy link

I can confirm upgrading my docker version from nhost/hasura-backend-plus:v2.2.1 to nhost/hasura-backend-plus:v2.2.4 fixed this exact issue.

@elitan
Copy link
Contributor

elitan commented Mar 25, 2021

I'll close this for now since upgrading seems to fix the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants