Troubleshooting

This guide helps you resolve common issues you might encounter when using Pika Framework.

Quick Diagnosis

Check Your Environment

First, verify your setup:

# Check Node.js version (should be 22+)
node --version

# Check pnpm version
pnpm --version

# Check Pika CLI version
pika --version

# Check AWS CLI (if using AWS features)
aws --version
bash

Common Error Patterns

  • Installation Issues: Node.js version, pnpm installation, permissions
  • Build Errors: TypeScript compilation, missing dependencies
  • Deployment Issues: AWS credentials, CDK bootstrap, IAM permissions
  • Runtime Errors: Environment variables, network connectivity, AWS service limits

Installation Issues

Node.js Version Problems

Node.js Version Error

Error: Node.js version 22.0.0 or higher is required

Solution:

# Check current version
node --version

# Update Node.js with Homebrew
brew upgrade node
bash

pnpm Installation Issues

pnpm Not Found

Error: pnpm: command not found

Solution:

# Use the official installer (recommended)
curl -fsSL https://get.pnpm.io/install.sh | sh -

# Verify installation
pnpm --version
bash

Build Issues

TypeScript Compilation Errors

Build Failure

Error: TypeScript compilation failed

Solution:

# Run in root of project, removes all .turbo, node_modules, etc.
pnpm run clean

# In root, install all deps
pnpm install

# In root, try to build everything
pnpm build

# In root, check typescript types
pnpm run check-types
bash

Missing Dependencies

Module Not Found

Error: Cannot find module 'xyz'

Solution:

# Reinstall all dependencies
pnpm install

# Clear pnpm cache
pnpm store prune

# Check for workspace issues
pnpm list --depth=0
bash

Build Script Failures

Script Exit Code

Error: Build script failed with exit code 1

Solution:

# Check build logs for specific errors
pnpm build --verbose

# Check for environment-specific issues
echo $NODE_ENV
bash

Deployment Issues

AWS Credentials Not Configured

AWS Credentials

Error: Unable to locate credentials

Solution:

# Configure AWS CLI
aws configure

# Verify credentials
aws sts get-caller-identity
bash

CDK Bootstrap Required

CDK Bootstrap

Error: This stack uses assets, so the toolkit stack must be deployed to the environment

Solution:

# Bootstrap CDK in your account/region
cdk bootstrap

# Verify bootstrap
aws cloudformation describe-stacks --stack-name CDKToolkit
bash

Insufficient IAM Permissions

IAM Permissions

Error: User is not authorized to perform: cloudformation:CreateStack

Solution:

  • Ensure your AWS user has the necessary permissions
  • Use an IAM role with appropriate permissions
  • Contact your AWS administrator for proper permissions

Required permissions:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": ["cloudformation:*", "s3:*", "lambda:*", "apigateway:*", "iam:*", "logs:*", "cloudwatch:*"],
            "Resource": "*"
        }
    ]
}
json

Domain Configuration Issues

Domain Issues

Error: Certificate not found or Hosted zone not found

Solution:

# Verify certificate exists
aws acm list-certificates --region us-east-1

# Check certificate ARN format
# Should be: arn:aws:acm:region:account:certificate/cert-id
bash

VPC Configuration Issues

VPC Issues

Error: VPC not found or Subnet not found

Solution:

# List VPCs
aws ec2 describe-vpcs
bash

Runtime Issues

Frontend Not Loading

Frontend Issues

Symptoms: Blank page, console errors, 404 errors

Solution:

# Check if development server is running
lsof -i :3000

# Check for build errors
cd apps/pika-chat && pnpm build
bash

Backend Services Not Responding

Backend Issues

Symptoms: Chat doesn't work, API errors, 500 responses

Solution:

# Check if services are deployed
aws cloudformation describe-stacks --stack-name mycompany-pika
bash

Authentication Issues

Authentication Issues

Symptoms: Login fails, session errors, unauthorized access

Solution:

# Check authentication provider configuration
cat apps/pika-chat/src/lib/server/auth-provider/index.ts

# Check browser cookies and local storage
# Clear browser cache and cookies if needed
bash

Sync Issues

Sync Command Fails

Sync Failure

Error: Failed to sync with framework

Solution:

# Check internet connection
ping github.com

# Use debug mode for more information
pika sync --debug
bash

Unexpected File Overwrites

File Overwrites

Symptoms: Custom files were overwritten during sync

Solution:

# Check sync configuration
cat .pika-sync.json

# Add files to userProtectedAreas
# Edit .pika-sync.json and add:
"userProtectedAreas": ["my-custom-file.ts"]
bash

Merge Conflicts

Conflicts

Symptoms: Sync stops due to conflicts

Solution:

# Review conflicts
pika sync --diff

# Resolve conflicts manually
# Edit conflicted files and remove conflict markers
bash

Debugging Tools

Enable Debug Logging

# Enable debug mode for various commands
pika sync --debug
pnpm run dev -- --debug
cdk deploy --debug

# Check environment variables
env | grep -i pika
env | grep -i aws
bash

Log Analysis

# View recent logs
aws logs tail /aws/lambda/mycompany-pika-service --follow
bash

Performance Monitoring

# Check Lambda function performance
aws cloudwatch get-metric-statistics \
    --namespace AWS/Lambda \
    --metric-name Duration \
    --dimensions Name=FunctionName,Value=mycompany-pika-service \
    --start-time 2024-01-01T00:00:00Z \
    --end-time 2024-01-02T00:00:00Z \
    --period 3600 \
    --statistics Average,Maximum
bash

Getting Help

Before Asking for Help

  1. Check this troubleshooting guide for your specific issue
  2. Search existing issues on the GitHub repository
  3. Check the documentation for your specific use case
  4. Try the solutions above for common issues

When Creating an Issue

Issue Report Template

Provide the following information for the best help:

Environment details:

  • Operating system and version
  • Node.js version
  • pnpm version
  • Pika CLI version

Error details:

  • Exact error message
  • Steps to reproduce
  • Expected vs actual behavior

Debug information:

  • Console output with --debug flag
  • Relevant log files
  • Configuration files (without sensitive data)

What you've tried:

  • Solutions attempted
  • Workarounds that work/don't work

Community Resources


Still having issues? Create a detailed issue on GitHub with all the information above, and the community will help you resolve it!

Last update at: 2025/09/17 14:37:11