rigby-sh / solace-medusa-starter

https://solace-medusa-starter.vercel.app
11 stars 3 forks source link

Missing Data in Strapi for Suggested Repo Initialization #95

Open PANhuihuihuihui opened 2 hours ago

PANhuihuihuihui commented 2 hours ago

Description:

After initializing this project using the suggested repository, my local Strapi instance does not contain any existing data. Attempts to fetch content such as the HeroBanner or MidBanner result in 404 and 401 status errors.

Question:

Do we have a migration script or sample data that I can use to populate Strapi? This would help verify if the setup and API endpoints are working as expected.

Error Details:

(I print url and access token)

http://localhost:1337/api/homepage?populate[1]=HeroBanner&populate[2]=HeroBanner.CTA&populate[3]=HeroBanner.Image
786cd40536f4d8b3dbe5b23d3bdd4bd349b254c1a376aae13d1a5a461f794d6ebccfe177c3181fcd09399f1ee049c22e58f63e387fd837f9defef270579ce2477a82cff6d42c90fa9ead685d1ad4ed83111724f14b462d9c689260f39ef9fa190e3801e787aa6931c688d37361c0f5d3cf5ca878437a3d97a3557857fb377dd2
Response {
  [Symbol(realm)]: null,
  [Symbol(state)]: {
    aborted: false,
    rangeRequested: false,
    timingAllowPassed: true,
    requestIncludesCredentials: true,
    type: 'default',
    status: 404,
    timingInfo: {
      startTime: 753812.560833,
      redirectStartTime: 0,
      redirectEndTime: 0,
      postRedirectStartTime: 753812.560833,
      finalServiceWorkerStartTime: 0,
      finalNetworkResponseStartTime: 0,
      finalNetworkRequestStartTime: 0,
      endTime: 0,
      encodedBodySize: 94,
      decodedBodySize: 94,
      finalConnectionTimingInfo: null
    },
    cacheState: '',
    statusText: 'Not Found',
    headersList: HeadersList {
      cookies: null,
      [Symbol(headers map)]: [Map],
      [Symbol(headers map sorted)]: null
    },
    urlList: [ URL {} ],
    body: { stream: undefined, length: undefined, source: undefined }
  },
  [Symbol(headers)]: HeadersList {
    cookies: null,
    [Symbol(headers map)]: Map(17) {
      'access-control-allow-origin' => [Object],
      'content-security-policy' => [Object],
      'referrer-policy' => [Object],
      'strict-transport-security' => [Object],
      'x-content-type-options' => [Object],
      'x-dns-prefetch-control' => [Object],
      'x-download-options' => [Object],
      'x-frame-options' => [Object],
      'x-permitted-cross-domain-policies' => [Object],
      'vary' => [Object],
      'access-control-allow-credentials' => [Object],
      'x-powered-by' => [Object],
      'content-type' => [Object],
      'content-length' => [Object],
      'date' => [Object],
      'connection' => [Object],
      'keep-alive' => [Object]
    },
    [Symbol(headers map sorted)]: null
  }
}
Received response with status 401

 ⨯ src/lib/data/fetch.ts (32:11) @ fetchStrapiClient
 ⨯ Error: Failed to fetch data
    at fetchStrapiClient (./src/lib/data/fetch.ts:28:15)
    at async getHeroBannerData (./src/lib/data/fetch.ts:34:17)
    at async Promise.all (index 1)
    at async Home (page.tsx:52:101)
digest: "1551898022"
  30 |     console.log(process.env.NEXT_PUBLIC_STRAPI_READ_TOKEN)
  31 |     console.log(response)
> 32 |     throw new Error('Failed to fetch data')
     |           ^
  33 |   }
  34 |
  35 |   return response
 ⨯ src/lib/data/fetch.ts (32:11) @ fetchStrapiClient
 ⨯ Error: Failed to fetch data
    at fetchStrapiClient (./src/lib/data/fetch.ts:28:15)
    at async getHeroBannerData (./src/lib/data/fetch.ts:34:17)
    at async Promise.all (index 1)
    at async Home (page.tsx:52:101)
digest: "1551898022"
  30 |     console.log(process.env.NEXT_PUBLIC_STRAPI_READ_TOKEN)
  31 |     console.log(response)
> 32 |     throw new Error('Failed to fetch data')
     |           ^
  33 |   }
  34 |
  35 |   return response
http://localhost:1337/api/homepage?populate[1]=MidBanner&populate[2]=MidBanner.CTA&populate[3]=MidBanner.Image
786cd40536f4d8b3dbe5b23d3bdd4bd349b254c1a376aae13d1a5a461f794d6ebccfe177c3181fcd09399f1ee049c22e58f63e387fd837f9defef270579ce2477a82cff6d42c90fa9ead685d1ad4ed83111724f14b462d9c689260f39ef9fa190e3801e787aa6931c688d37361c0f5d3cf5ca878437a3d97a3557857fb377dd2
Response {
  [Symbol(realm)]: null,
  [Symbol(state)]: {
    aborted: false,
    rangeRequested: false,
    timingAllowPassed: true,
    requestIncludesCredentials: true,
    type: 'default',
    status: 404,
    timingInfo: {
      startTime: 753813.106708,
      redirectStartTime: 0,
      redirectEndTime: 0,
      postRedirectStartTime: 753813.106708,
      finalServiceWorkerStartTime: 0,
      finalNetworkResponseStartTime: 0,
      finalNetworkRequestStartTime: 0,
      endTime: 0,
      encodedBodySize: 94,
      decodedBodySize: 94,
      finalConnectionTimingInfo: null
    },
    cacheState: '',
    statusText: 'Not Found',
    headersList: HeadersList {
      cookies: null,
      [Symbol(headers map)]: [Map],
      [Symbol(headers map sorted)]: null
    },
    urlList: [ URL {} ],
    body: { stream: undefined, length: undefined, source: undefined }
  },
  [Symbol(headers)]: HeadersList {
    cookies: null,
    [Symbol(headers map)]: Map(17) {
      'access-control-allow-origin' => [Object],
      'content-security-policy' => [Object],
      'referrer-policy' => [Object],
      'strict-transport-security' => [Object],
      'x-content-type-options' => [Object],
      'x-dns-prefetch-control' => [Object],
      'x-download-options' => [Object],
      'x-frame-options' => [Object],
      'x-permitted-cross-domain-policies' => [Object],
      'vary' => [Object],
      'access-control-allow-credentials' => [Object],
      'x-powered-by' => [Object],
      'content-type' => [Object],
      'content-length' => [Object],
      'date' => [Object],
      'connection' => [Object],
      'keep-alive' => [Object]
    },
    [Symbol(headers map sorted)]: null
  }
}

Attachments:

image

PANhuihuihuihui commented 2 hours ago

Updates

it seems like we are using aws-s3 to storage the content. could we share the path and key in .env ?

export default ({ env }) => ({
  upload: {
    config: {
      provider: "aws-s3",
      providerOptions: {
        rootPath: env("DO_SPACE_PATH"),
        credentials: {
          accessKeyId: env("DO_SPACE_ACCESS_KEY"),
          secretAccessKey: env("DO_SPACE_SECRET_KEY"),
        },
        region: env("DO_SPACE_REGION"),
        endpoint: env("DO_SPACE_ENDPOINT"),
        params: {
          Bucket: env("DO_SPACE_BUCKET"),
        },
      },
      actionOptions: {
        upload: {},
        uploadStream: {},
        delete: {},
      },
    },
  },
});