gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.29k stars 10.31k forks source link

ERROR URI malformed RequestError: URI malformed #35941

Closed hectorrodriguez773 closed 2 years ago

hectorrodriguez773 commented 2 years ago

Preliminary Checks

Description

I'm doing the upgrade for Gatsby 2 to 4 and I'm trying to use the same env Screen Shot 2022-06-15 at 2 57 58 PM

Reproduction Link

N/A

Steps to Reproduce

1. 2. 3. ...

Expected Result

info Starting to fetch all data from Drupal success Fetch all data from Drupal - 58.190s

Actual Result

info Starting to fetch all data from Drupal

ERROR

URI malformed

RequestError: URI malformed

failed Fetch all data from Drupal - 0.216s

Environment

System:
    OS: macOS 11.5.2
    CPU: (8) x64 Apple M1
    Shell: 3.3.1 - /opt/homebrew/opt/fish/bin/fish
  Binaries:
    Node: 14.17.5 - /usr/local/bin/node
    Yarn: 1.22.17 - ~/.yarn/bin/yarn
    npm: 6.14.14 - /usr/local/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 102.0.5005.115
    Firefox: 98.0.2
    Safari: 14.1.2
  npmPackages:
    gatsby: ^4.16.0 => 4.16.0 
    gatsby-alias-imports: ^1.0.6 => 1.0.6 
    gatsby-drupal-webform: ^4.0.0 => 4.0.0 
    gatsby-image: ^3.11.0 => 3.11.0 
    gatsby-plugin-advanced-sitemap: ^2.1.0 => 2.1.0 
    gatsby-plugin-fontawesome-css: ^1.2.0 => 1.2.0 
    gatsby-plugin-google-analytics: ^4.16.0 => 4.16.0 
    gatsby-plugin-google-fonts-with-attributes: ^1.0.8 => 1.0.8 
    gatsby-plugin-google-gtag: ^4.16.0 => 4.16.0 
    gatsby-plugin-hotjar: ^1.1.1 => 1.1.1 
    gatsby-plugin-image: ^2.16.1 => 2.16.1 
    gatsby-plugin-layout: ^3.16.0 => 3.16.0 
    gatsby-plugin-manifest: ^4.16.0 => 4.16.0 
    gatsby-plugin-mdx: ^3.16.1 => 3.16.1 
    gatsby-plugin-react-helmet: ^5.16.0 => 5.16.0 
    gatsby-plugin-remove-fingerprints: ^0.0.2 => 0.0.2 
    gatsby-plugin-remove-serviceworker: ^1.0.0 => 1.0.0 
    gatsby-plugin-remove-trailing-slashes: ^4.16.0 => 4.16.0 
    gatsby-plugin-robots-txt: ^1.7.1 => 1.7.1 
    gatsby-plugin-sass: ^5.16.0 => 5.16.0 
    gatsby-plugin-sharp: ^4.16.1 => 4.16.1 
    gatsby-plugin-sitemap: ^5.16.0 => 5.16.0 
    gatsby-plugin-use-query-params: ^1.0.1 => 1.0.1 
    gatsby-source-drupal: ^5.17.1 => 5.17.1 
    gatsby-source-filesystem: ^4.16.0 => 4.16.0 
    gatsby-source-graphql: ^4.16.0 => 4.16.0 
    gatsby-transformer-remark: ^5.16.0 => 5.16.0 
    gatsby-transformer-sharp: ^4.16.0 => 4.16.0 
  npmGlobalPackages:
    gatsby-cli: 4.16.0

Config Flags

No response

KyleAMathews commented 2 years ago

Check that the options for gatsby-source-drupal haven't changed. Also did you upgrade all the packages?

On Wed, Jun 15, 2022, 10:00 PM Hector Rodriguez @.***> wrote:

Preliminary Checks

Description

I'm doing the upgrade for Gatsby 2 to 4 and I'm trying to use the same env [image: Screen Shot 2022-06-15 at 2 57 58 PM] https://user-images.githubusercontent.com/82678272/173916036-0f00770b-454b-4d51-986f-9e233aa7c982.png Reproduction Link

N/A Steps to Reproduce

1. 2. 3.

... Expected Result

info Starting to fetch all data from Drupal success Fetch all data from Drupal - 58.190s Actual Result

info Starting to fetch all data from Drupal

ERROR

URI malformed

RequestError: URI malformed

-

index.js:1386 Request._destroy [rootstack-website]/[got]/dist/source/core/index.js:1386:21

destroy.js:39 Request.destroy internal/streams/destroy.js:39:8

index.js:354 [rootstack-website]/[got]/dist/source/core/index.js:354:26

index.js:357 new Request [rootstack-website]/[got]/dist/source/core/index.js:357:11

index.js:35 makeRequest [rootstack-website]/[got]/dist/source/as-promise/index.js:35:29

index.js:147 [rootstack-website]/[got]/dist/source/as-promise/index.js:147:9

index.js:63 [rootstack-website]/[p-cancelable]/index.js:63:11

new Promise

index.js:31 new PCancelable [rootstack-website]/[p-cancelable]/index.js:31:19

index.js:33 Object.asPromise [as default] [rootstack-website]/[got]/dist/source/as-promise/index.js:33:21

create.js:43 getPromiseOrStream [rootstack-website]/[got]/dist/source/create.js:43:121

create.js:68 [rootstack-website]/[got]/dist/source/create.js:68:20

create.js:53 exports.defaultHandler [rootstack-website]/[got]/dist/source/create.js:53:45

create.js:67 Array. [rootstack-website]/[got]/dist/source/create.js:67:24

create.js:89 iterateHandlers [rootstack-website]/[got]/dist/source/create.js:89:50

create.js:117 got [rootstack-website]/[got]/dist/source/create.js:117:20

decodeURI

index.js:332 [rootstack-website]/[got]/dist/source/core/index.js:332:17

index.js:357 new Request [rootstack-website]/[got]/dist/source/core/index.js:357:11

index.js:35 makeRequest [rootstack-website]/[got]/dist/source/as-promise/index.js:35:29

index.js:147 [rootstack-website]/[got]/dist/source/as-promise/index.js:147:9

index.js:63 [rootstack-website]/[p-cancelable]/index.js:63:11

new Promise

index.js:31 new PCancelable [rootstack-website]/[p-cancelable]/index.js:31:19

index.js:33 Object.asPromise [as default] [rootstack-website]/[got]/dist/source/as-promise/index.js:33:21

create.js:43 getPromiseOrStream [rootstack-website]/[got]/dist/source/create.js:43:121

create.js:68 [rootstack-website]/[got]/dist/source/create.js:68:20

create.js:53 exports.defaultHandler [rootstack-website]/[got]/dist/source/create.js:53:45

create.js:67 Array. [rootstack-website]/[got]/dist/source/create.js:67:24

create.js:89 iterateHandlers [rootstack-website]/[got]/dist/source/create.js:89:50

create.js:117 got [rootstack-website]/[got]/dist/source/create.js:117:20

gatsby-node.js:105 worker [rootstack-website]/[gatsby-source-drupal]/gatsby-node.js:105:26

failed Fetch all data from Drupal - 0.216s Environment

System: OS: macOS 11.5.2 CPU: (8) x64 Apple M1 Shell: 3.3.1 - /opt/homebrew/opt/fish/bin/fish Binaries: Node: 14.17.5 - /usr/local/bin/node Yarn: 1.22.17 - ~/.yarn/bin/yarn npm: 6.14.14 - /usr/local/bin/npm Languages: Python: 2.7.16 - /usr/bin/python Browsers: Chrome: 102.0.5005.115 Firefox: 98.0.2 Safari: 14.1.2 npmPackages: gatsby: ^4.16.0 => 4.16.0 gatsby-alias-imports: ^1.0.6 => 1.0.6 gatsby-drupal-webform: ^4.0.0 => 4.0.0 gatsby-image: ^3.11.0 => 3.11.0 gatsby-plugin-advanced-sitemap: ^2.1.0 => 2.1.0 gatsby-plugin-fontawesome-css: ^1.2.0 => 1.2.0 gatsby-plugin-google-analytics: ^4.16.0 => 4.16.0 gatsby-plugin-google-fonts-with-attributes: ^1.0.8 => 1.0.8 gatsby-plugin-google-gtag: ^4.16.0 => 4.16.0 gatsby-plugin-hotjar: ^1.1.1 => 1.1.1 gatsby-plugin-image: ^2.16.1 => 2.16.1 gatsby-plugin-layout: ^3.16.0 => 3.16.0 gatsby-plugin-manifest: ^4.16.0 => 4.16.0 gatsby-plugin-mdx: ^3.16.1 => 3.16.1 gatsby-plugin-react-helmet: ^5.16.0 => 5.16.0 gatsby-plugin-remove-fingerprints: ^0.0.2 => 0.0.2 gatsby-plugin-remove-serviceworker: ^1.0.0 => 1.0.0 gatsby-plugin-remove-trailing-slashes: ^4.16.0 => 4.16.0 gatsby-plugin-robots-txt: ^1.7.1 => 1.7.1 gatsby-plugin-sass: ^5.16.0 => 5.16.0 gatsby-plugin-sharp: ^4.16.1 => 4.16.1 gatsby-plugin-sitemap: ^5.16.0 => 5.16.0 gatsby-plugin-use-query-params: ^1.0.1 => 1.0.1 gatsby-source-drupal: ^5.17.1 => 5.17.1 gatsby-source-filesystem: ^4.16.0 => 4.16.0 gatsby-source-graphql: ^4.16.0 => 4.16.0 gatsby-transformer-remark: ^5.16.0 => 5.16.0 gatsby-transformer-sharp: ^4.16.0 => 4.16.0 npmGlobalPackages: gatsby-cli: 4.16.0

Config Flags

No response

β€” Reply to this email directly, view it on GitHub https://github.com/gatsbyjs/gatsby/issues/35941, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAARLB3EBXK5SVRALCN7N7DVPIY4XANCNFSM5Y4PLTBA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

hectorrodriguez773 commented 2 years ago

For that reason I think is a bug, because I'm sending the same baseUrl, and yes I did the upgrade for all packages. I started a gatsby project from scratch to avoid conflicts so not sure what's wrong.

here my options

options: {
        baseUrl: process.env.GATSBY_BASE_URL_API,
        apiBase: 'jsonapi',
        basicAuth: {
          username: process.env.BASIC_AUTH_USER,
          password: process.env.BASIC_AUTH_PASSWORD
        },
        secret: process.env.PREVIEW_SECRET,
        fastBuilds: false,
        concurrentFileRequests: 60,
        skipFileDownloads: process.env.SKIP_FILE_DOWNLOADS,
        entityReferenceRevisions: ['paragraph'],
        languageConfig: {
          defaultLanguage: process.env.GATSBY_DEFAULT_LANG || 'en',
          enabledLanguages: ['en', 'es'],
          translatableEntities: ['node--blog'],
          nonTranslatableEntities: ['file--file'],
        }
      }
KyleAMathews commented 2 years ago

Can you add a console.log to see what urls are being passed to got in node_modules/gatsby-source-drupal/gatsby-node.js?

On Wed, Jun 15, 2022, 11:07 PM Hector Rodriguez @.***> wrote:

For that reason I think is a bug, because I'm sending the same baseUrl, and yes I did the upgrade for all packages. I started a gatsby project from scratch to avoid conflicts so not sure what's wrong.

here my options

options: { baseUrl: process.env.GATSBY_BASE_URL_API, apiBase: 'jsonapi', basicAuth: { username: process.env.BASIC_AUTH_USER, password: process.env.BASIC_AUTH_PASSWORD }, secret: process.env.PREVIEW_SECRET, fastBuilds: false, concurrentFileRequests: 60, skipFileDownloads: process.env.SKIP_FILE_DOWNLOADS, entityReferenceRevisions: ['paragraph'], languageConfig: { defaultLanguage: process.env.GATSBY_DEFAULT_LANG || 'en', enabledLanguages: ['en', 'es'], translatableEntities: ['node--blog'], nonTranslatableEntities: ['file--file'], } }

β€” Reply to this email directly, view it on GitHub https://github.com/gatsbyjs/gatsby/issues/35941#issuecomment-1156944041, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAARLBZIHY3HDLS7L2NTCCDVPJAXPANCNFSM5Y4PLTBA . You are receiving this because you commented.Message ID: @.***>

hectorrodriguez773 commented 2 years ago

I did it before this line 463 -> const res = await requestQueue.push([urlJoin(baseUrl, apiBase), {

and the url was the expected one https://<< my-domain >>/jsonapi

KyleAMathews commented 2 years ago

I mean in the worker above for the request queue where a rule is passed into got

hectorrodriguez773 commented 2 years ago

Ok Seems like the issue is with this

const response = await got(url, {
    agent,
    cache: false,
    // request: http2wrapper.auto,
    // http2: true,
    ...options
  });

But the URL is fine. I'm using basicAuth maybe is something related to that?

This is the console log. BTW my domain is like this https://cms.my-domain.com

url: https://cms.my-domain.com/jsonapi
parsedUrl: URL {
  href: 'https://cms.my-domain.com/jsonapi',
  origin: 'https://cms.my-domain.com',
  protocol: 'https:',
  username: '',
  password: '',
  host: 'cms.my-domain.com',
  hostname: 'cms.my-domain.com',
  port: '',
  pathname: '/jsonapi',
  search: '',
  searchParams: URLSearchParams {},
  hash: ''
}
URL after: https://cms.my-domain.com/jsonapi
hectorrodriguez773 commented 2 years ago

I just created a project form scratch and include only that plugin and is not working getting the same error, I just wondering if it's related to the domain probably?

LekoArts commented 2 years ago

Hi!

Sorry to hear you're running into an issue. To help us best begin debugging the underlying cause, it is incredibly helpful if you're able to create a minimal reproduction. This is a simplified example of the issue that makes it clear and obvious what the issue is and how we can begin to debug it.

If you're up for it, we'd very much appreciate if you could provide a minimal reproduction and we'll be able to take another look.

Thanks for using Gatsby! πŸ’œ

github-actions[bot] commented 2 years ago

Hiya!

This issue has gone quiet. Spooky quiet. πŸ‘»

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! πŸ’ͺπŸ’œ

LekoArts commented 2 years ago

Hi!

Since we didn't receive an answer for 7 days or more about the ask of a reproduction I'm going to close this now, as we can't do much to help without a reproduction. If you are able to create a minimal reproduction for this then please do answer here or open a new issue with a reproduction. Thanks!

davidfvo commented 2 years ago

@hectorrodriguez773

Hi Hector!

We solved the issue by adding the corresponding Drupal credential. Before Gatsby 4, we used a generic credential, but now it seems that it is required. I hope it helps you!