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

originalFetch is not a function #16

Open
thanneeruvenu opened this issue Jun 5, 2024 · 1 comment
Open

originalFetch is not a function #16

thanneeruvenu opened this issue Jun 5, 2024 · 1 comment

Comments

@thanneeruvenu
Copy link

Expected Behaviour

Actual Behaviour

Reproduce Scenario (including but not limited to)

Steps to Reproduce

const proxyFetch = createFetch();

        const aemHeadlessClient = new AEMHeadless({
            serviceURL: ' ',
            endpoint: '/content/_cq_graphql/global/endpoint.json',
            fetch: proxyFetch,
            headers: {'content-type': 'application/json', 'accept': 'application/json'},
            // auth: ['admin', 'admin'],
            //auth: [AEM_USER, AEM_PASS],
            // headers: {'customerheadername': 'customerheadervalue'}
        });
        aemHeadlessClient.runQuery(`query homePageQueery {
            homepageFragmentList {
              items {
                _path
                title
              }
            }
          }`)
            .then(data => 
                
                console.log(data))
            .catch(e => 
                console.error(e))

Platform and Version

Sample Code that illustrates the problem

Logs taken while reproducing problem

AioCoreSDKError [AEMHeadlessError]: [AEMHeadless:REQUEST_ERROR] General Request error: originalFetch is not a function.
code: 'REQUEST_ERROR',
sdk: 'AEMHeadless',

@easingthemes
Copy link
Collaborator

easingthemes commented Jul 10, 2024

fetch can be any custom valid implementation of fetch.
Error is coming from

    try {
      response = await this.fetch(url, requestOptions, retryOptions)
    } catch (error) {
      // 1.1 Request error: general
      throw new REQUEST_ERROR({

which means that your custom proxyFetch is not a function.

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