docusealco / docuseal

Open source DocuSign alternative. Create, fill, and sign digital documents ✍️
https://www.docuseal.co
GNU Affero General Public License v3.0
5.61k stars 372 forks source link

CORS error on Next.js #198

Closed mnzsss closed 5 months ago

mnzsss commented 5 months ago

I used DigitalOcean for deploy aplication and when I try use the DocusealForm component of @docuseal/react package I got CORS error.

I use my host with SSL and consume the api with the another domain with SSL

Have a any solution or config for that?

import { DocusealForm } from '@docuseal/react'

export default function DocuAssingn() {
 return (
    <DocusealForm
      src="https://self-hosted.com/d/slug"
      onComplete={(data) => console.log(data)}
    />
  )
}

print

omohokcoj commented 5 months ago

@mnzsss embedding is available only in DocuSeal Pro paid version (Cloud and Self-hosted). The reason why you receive CORS and 404 is that embedding API is not available in open-source docuseal docker app. We will improve the API to add a clear message about the features available in open-source.

JapSeyz commented 4 months ago

The same error seems to be present in prod, even on sandbox mode:

I am on sandbox, and supposedly have unlimited embeddings to test:

image

But when testing, I receive the same error as above:

If I pass an email attribute into the Vue component, it happens immediately, if I omit the email, it happens as soon as I click "Start"

image image

Might be a bug, @omohokcoj ?

omohokcoj commented 4 months ago

@JapSeyz can you please share your embedding code/script?

JapSeyz commented 4 months ago
DocusealForm(
    :src="template"
    :role="role"
    logo="/images/logo.png"
    :skip-fields="false"
    :with-field-names="false"
    :with-title="false"
    :with-send-copy-button="false"
    :send-copy-email="false"
    @complete="onComplete"
  )

template = https://docuseal.co/d/{SLUG} role = Test A/S

omohokcoj commented 4 months ago

@JapSeyz role 'Test A/S' doesn't exist in your template (only one role name: 'First Party' is present in the template)

JapSeyz commented 4 months ago

Oh, those two has to match? I was not aware. It's quite an obscure error to throw for that, but thank you for the swift response

omohokcoj commented 4 months ago

@JapSeyz yeah we need to improve the error handling in embedding - the error message is correct in the API response - the problem is that it doesn't include CORS headers and was blocked by the browser. We will add CORS headers and make the error messages visible in the next release. Thanks for pointing this out

JapSeyz commented 4 months ago

Alright, thank you. And again, thanks for the extremely swift response