I am doing it by using endpointString.apply(…) and...
# general
q
I am doing it by using endpointString.apply(…) and sometimes it gets created, sometimes it gets deleted
w
Are you invoking the Lambda using the AWS SDK inside the Google Cloud Function? Or are you trying to invoke it through an HTTP endpoint (API Gateway)? There is no direct HTTP-addressable endpoint for a raw AWS Lambda.
q
http endpoint call
w
API Gateway?
q
it’s not a raw lambda, it’s a
cloud.API
sorry
w
Ahh - got it.
Note that you need to call
api.publish()
for the API to get created. The response from that is https://pulumi.io/reference/pkg/nodejs/@pulumi/cloud/index.html#HttpDeployment which has a
url
property you should be able to `GET`/`POST`.
q
Yea it is mostly working
But sometimes it seems like pulumi wants to delete the gcloud function
I'm assuming because im creating it in an apply() handler?
w
Ahh. Yes - you should in general not create resources inside an
apply
. This will frequently lead to misleading previews.
q
Basically i need to wait for the lambda url to be ready and create the gcloud function after
w
You should rarely need to do this - in almost all cases you should be able to pass the derived values into the constructor of the Google Cloud function.
Like:
Copy code
let api = new API();
let url = api.publish().url;
let gcloudfunction = new Function("f", async () => {
   console.log(url.get());
});
q
When I did that I got an error about pulumi resource. JS missing
Sorry I am having to voice to text
w
Might be easiest to open an issue with repro steps and error message?
q
No problem. I can do that on Monday. Thanks for your help
@white-balloon-205 I must have done something wrong initially because I tried
url.get()
again and it’s working. Thanks!
👍 1