Build failed on Cloudflare Pages.
Hello everyone. I have a cloudflare page which watches the github repository and deploy the changes once the PR is created.
I got heap out of memory issue once I've added some addtional features to my code.
To handle this problem, I've increased memory usage by using the following command.
NODE_OPTIONS="--max-old-space-size=7680"
The problem is, I get memory exceed error from Cloudflare build after adding the above command.
Is it possible to increase the memory limit of Cloudflare pages?
Or can I move the building step out of the Cloudflare pages?5 Replies
You can use the wrangler GitHub action to deploy from GitHub actions, and then just npm run build or whatever to build it in that workflow
Wow, that will be great. Can you share more details about it? I'm not that familiar with wrangler.
name: Checkout Code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v3
- name: Install Dependencies
run: npm install
- name: Build React App
run: npm run build
env:
CI: false
- name: Deploy To Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
command: pages deploy dist --project-name=yourprojectname --branch=${{ env.BRANCH_NAME }}
This is how I do it
This is great. Thank you for your help.
No problem!