How to Handle CSP Errors in Strapi

Overview I configured Strapi with the following plugin to store media in S3. https://www.npmjs.com/package/@liashchynskyi/strapi-provider-upload-s3-cloudfront At that time, the following error occurred and images were not displayed. R e f u s e d t o l o a d t h e i m a g e ' h t t p s : / / x x x / u p l o a d s / y y y . j p g ' b e c a u s e i t v i o l a t e s t h e f o l l o w i n g C o n t e n t S e c u r i t y P o l i c y d i r e c t i v e : " i m g - s r c ' s e l f ' d a t a : b l o b : d l . a i r t a b l e . c o m " . I was able to resolve this issue by modifying ./config/middleware.js, as described in the following article. ...

June 12, 2024 · 2 min · Nakamura

Trying Strapi's Data Transfer

Overview I had the opportunity to deploy local environment data to a production environment in Strapi, so I tried using the following Data transfer feature. https://docs.strapi.io/dev-docs/data-management/transfer Steps Production Environment Side Issue a Transfer Token on the production environment side. Local Environment Let’s say the production site is https://strapi.example.org and the token is xxx. With the following command, I was able to deploy the local environment data to the production environment. ...

June 12, 2024 · 2 min · Nakamura

Sorting and Pagination in Strapi v4 GraphQL

I looked into how to perform sorting and pagination with Strapi v4’s GraphQL. Documentation was found at the following location. https://docs.strapi.io/dev-docs/api/graphql Specifically, pagination and sorting could be performed by writing queries like the following. q } u e b } r l y o m } d } g e a { P t p } t i a } o a a a d t s g t t c t { i o { r r s n t i e ( a a b a p t l u t a i t e g o e d i n s A n t a { { t i o n : { p a g e : 1 , p a g e S i z e : 1 0 } , s o r t : " c r e a t e d A t : d e s c " ) { I hope this serves as a helpful reference. ...

June 16, 2023 · 1 min · Nakamura

Integrating Strapi with Amazon OpenSearch

Overview The following article was helpful for integrating Strapi with Elasticsearch. https://punits.dev/blog/integrating-elasticsearch-with-strapi/ The source code is also publicly available. https://github.com/geeky-biz/strapi-integrate-elasticsearch Here, I will note some customizations made based on the above article, including integration with Amazon OpenSearch. The customized source code is available here: https://github.com/nakamura196/strapi-integrate-opensearch Modifications The article references indexing_type, but it needed to be changed to indexing_request_type. https://github.com/nakamura196/strapi-integrate-opensearch/blob/006c533d4d7882fc9779552db31a7b0e2ada5e57/elastic/cron-search-indexing.js#L16 Additionally, to use Amazon OpenSearch instead of Elasticsearch, the following libraries need to be installed. ...

May 26, 2023 · 2 min · Nakamura

Configuring Strapi's REST API

Overview This is a memo on some configuration settings for Strapi’s REST API. Changing the Search Result Limit The following documentation describes this. https://docs.strapi.io/dev-docs/api/rest/sort-pagination#pagination Specifically: The default and maximum values for pagination[limit] can be configured in the ./config/api.js file with the api.rest.defaultLimit and api.rest.maxLimit keys. m } o ; d r } u e , l s d m w e t e a i . : f x t e a L h x { u i C p l m o o t i u r L t n t i : t s m : i 1 = t 0 t : 0 r { 0 u 2 , e 5 , , 1 0 0 , Retrieving Items Including Those with Draft STATE By default, items with a Draft STATE could not be retrieved. The following article was helpful. ...

May 26, 2023 · 1 min · Nakamura

Auth0 Provider and Strapi Tutorial

Overview I tried authenticating Strapi using Auth0. I was able to accomplish this by following the steps in the article below. https://strapi.io/blog/auth0-provider-and-strapi-tutorial-1 However, in the section specifying Allowed Callback URLs, I needed to change http://localhost:1337/connect/auth0/callback to http://localhost:1337/api/connect/auth0/callback. (Reference) GitHub Following the above steps as a reference, I was also able to successfully configure GitHub as a provider.

April 24, 2023 · 1 min · Nakamura

Strapi: How to Filter Results by Deeply Nested Fields

Overview The following article introduces how to filter results by deeply nested fields. https://strapi.io/blog/deep-filtering-alpha-26 As described above, by preparing the content types and fields, I was able to obtain the intended results. Notes As mentioned in the comments of the above article, the text contains “" characters, but these appear to be unnecessary. Incorrect G E T / a p i / b o o k s ? f i l t e r s \ [ a u t h o r s \ ] [ h o b b y ] [ $ c o n t a i n s ] = d a n c e By using the query without “" as follows, the intended results were obtained. ...

April 22, 2023 · 1 min · Nakamura

Adding GraphQL to Strapi

Overview In the following article, I launched Strapi on Amazon Lightsail. This time, I add GraphQL and try using it. Installing the GraphQL Plugin I ran the following. Please adjust paths like backend as needed. c y d a r n o p a t d / d b i @ t s n t a r m a i p / i a / p p a l c u h g e i 2 n / - h g t r d a o p c h s q / l b a c k e n d Then, start the application. ...

April 12, 2023 · 3 min · Nakamura

Running Strapi on Amazon Lightsail (SSL, Custom Domain)

Overview I had the opportunity to run Strapi on Amazon Lightsail, so this is a personal note. I referenced the following article. https://zenn.dev/holykzm/articles/1e54cc25207657 Instance Select Node.js. Please select one with 1GB or more of memory. If you build on Lightsail, an out-of-memory error will occur. SSL, Custom Domain Please refer to the following. /en/posts/5772d6c918508a/#独自ドメインの付与 Assign a Static IP, set up a custom domain with Route 53, and execute the following. ...

April 11, 2023 · 4 min · Nakamura