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

Failed to generate sitemap #916

Closed
Sarowar-neo opened this issue Sep 12, 2020 · 1 comment · Fixed by #929
Closed

Failed to generate sitemap #916

Sarowar-neo opened this issue Sep 12, 2020 · 1 comment · Fixed by #929
Labels
bug Something isn't working

Comments

@Sarowar-neo
Copy link

npm run sitemap http://localhost:3000/
file path: /saleor-storefront/src/core/utils.ts

saleor 2.10

(node:21111) UnhandledPromiseRejectionWarning: Error: Network error: only absolute urls are supported
at new ApolloError

export const parseQueryString = (
  location: LocationState
): { [key: string]: string } => {
  const query = {
    ...parseQs((location as any).search.substr(1)),
  };
  each(query, (value, key) => {
    if (Array.isArray(value)) {
      query[key] = value[0];
    }
  });
  return query as { [key: string]: string };
};

(node:21111) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:21111) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

saleor 2.11

TSError: ⨯ Unable to compile TypeScript

export const parseQueryString = (
  location: LocationState
): { [key: string]: string } => {
  let query: Record<string, string> = parseQs(window.location.search.substr(1));

  each(query, (value, key) => {
    if (Array.isArray(value)) {
      query = {
        ...query,
        [key]: value[0],
      };
    }
  });
  return query;
};

TSError: ⨯ Unable to compile TypeScript:
src/core/utils.ts:132:7 - error TS2322: Type 'ParsedQuery' is not assignable to type 'Record<string, string>'.
Index signatures are incompatible.
Type 'string | string[]' is not assignable to type 'string'.
Type 'string[]' is not assignable to type 'string'.

132 let query: Record<string, string> = parseQs(window.location.search.substr(1));

@maarcingebala maarcingebala transferred this issue from saleor/saleor Oct 2, 2020
@orzechdev orzechdev added the bug Something isn't working label Oct 7, 2020
@karolkielecki
Copy link

@Sarowar-neo Hi! Thanks for letting us know. There is a bug and you can't generate a sitemap at the moment. You can find PR here: #915

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants