Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,10 @@ You'll get this error when there is no bundled output on the `/dist` directory.
This will usually happen when the bundled code does not include `@as-integrations/google-cloud-functions` source code on the final bundle. **It is important to have the source-code for the integration bundled *within* your function** because of how Google Cloud Functions reads the function entry point.

In `scripts/buildConfig.mjs`, make sure that the `external` array **does not** include `@as-integrations/google-cloud-functions`. Every other direct dependency that can be normally resolved by package.json should be included on the `external` array.

### I got an error `Provided source directory does not have file [package.json]…`

The quick workaround for this is to add a soft link in the `dist` directory to the `package.json` file here (in the `example` directory).
```
$ ln package.json dist/package.json
```
23 changes: 12 additions & 11 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,24 @@
"build": "npm run with-env node scripts/build.mjs",
"watch": "npm run with-env node scripts/watch.mjs",
"start": "dotenv -e .env -- functions-framework --source=./dist",
"deploy": "gcloud functions deploy $(grep FUNCTION_TARGET .env | cut -d '=' -f2) --gen2 --runtime nodejs16 --trigger-http --allow-unauthenticated --entry-point=$(grep FUNCTION_TARGET .env | cut -d '=' -f2) --source=./dist --region=us-central1",
"deploy": "gcloud functions deploy $(grep FUNCTION_TARGET .env | cut -d '=' -f2) --gen2 --runtime nodejs20 --trigger-http --allow-unauthenticated --entry-point=$(grep FUNCTION_TARGET .env | cut -d '=' -f2) --source=./dist --region=us-central1",
"clean": "rimraf dist",
"with-env": "dotenv -e .env --"
"with-env": "dotenv -e .env --",
"gcp-build": ""
},
"dependencies": {
"@apollo/server": "^4.3.0",
"@apollo/server": "^4.11.0",
"@apollo/utils.withrequired": "^3.0.0",
"@as-integrations/google-cloud-functions": "file:..",
"@google-cloud/functions-framework": "^3.1.3",
"graphql": "^16.6.0"
"@as-integrations/google-cloud-functions": "^0.1.4",
"@google-cloud/functions-framework": "^3.4.2",
"graphql": "^16.9.0"
},
"devDependencies": {
"@types/node": "18.11.18",
"dotenv-cli": "7.3.0",
"esbuild": "0.20.1",
"rimraf": "5.0.5",
"@types/node": "22.5.5",
"dotenv-cli": "7.4.2",
"esbuild": "0.23.1",
"rimraf": "6.0.1",
"ts-node": "10.9.2",
"typescript": "5.3.3"
"typescript": "5.6.2"
}
}
2 changes: 1 addition & 1 deletion example/scripts/buildConfig.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const commonConfig = {
/**
* Match this to the --runtime flag during deployment.
*/
target: 'node16',
target: 'node20',

/**
* When in development mode, this log level will print bundle changes in the terminal.
Expand Down
Loading