Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@as-integrations/google-cloud-functions
Advanced tools
An integration to use Google Cloud Functions as a hosting service with Apollo Server
A simple Apollo Server integration for use with Google Cloud Functions
npm install @as-integrations/google-cloud-functions @google-cloud/functions/framework @apollo/server graphql
In the root of your project, create an Apollo Server instance and pass it to startServerAndCreateGoogleCloudFunctionsHandler
, imported from @as-integrations/google-cloud-functions
:
Google Cloud Functions requires you to name the function entry point. In this example, we name it apollo-graphql
. Take note the the name you give to the function is the name you will use when deploying to Google Cloud Functions:
import { ApolloServer } from "@apollo/server";
import { startServerAndCreateGoogleCloudFunctionsHandler } from "@as-integrations/google-cloud-functions";
const resolvers = {
Query: {
hello: () => 'world',
},
};
const typeDefs = gql`
type Query {
hello: String
}
`;
const server = new ApolloServer({
resolvers,
typeDefs,
});
startServerAndCreateGoogleCloudFunctionsHandler(server, { functionTarget: "apollo-graphql" });
To develop, test and deploy your function, you will need to setup proper tooling to bundle your function and its dependencies.
We highly recommend taking a look at the the project example, which gives you an good starting point and sane defaults on how you can correctly bundle your function using esbuild
and setup scripts for common development tasks.
Note
Why do I need to bundle my function?
You're probably writing your function in TypeScript, and you're probably using modern syntax from ES Modules like
import
andexport
. Google Cloud Functions Framework for Node.js does not support TypeScript, and it does not understand ES Modules.Futhermore, Google Cloud Functions works by having an entry point signature supplied to the function handler. This means that the final bundle of code that gets uploaded to Google Cloud Functions needs to visibly have the function entry point, otherwise it will fail with the error:
Function <function-name> is not defined in the provided module...
.
FAQs
An integration to use Google Cloud Functions as a hosting service with Apollo Server
The npm package @as-integrations/google-cloud-functions receives a total of 129 weekly downloads. As such, @as-integrations/google-cloud-functions popularity was classified as not popular.
We found that @as-integrations/google-cloud-functions demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.