I can't seem to find the solution for a runtime/pr...
# general
s
I can't seem to find the solution for a runtime/promisse error I'm having (with Pulumi's GCP module). This is my code (I pasted the code on the same hastebin page): https://hastebin.com/etajakubid.js
a
try if moving all functions into your lambda that you specific in HttpCallbackFunction
including the require statements
that should work πŸ˜‰
might be a bit extreme
f
I don’t think you need the
const gs = require('./crud.js')
to be within the functions? I answered your GH issue with an example of moving the actual
@google-cloud/datastore
import within the function within one of the
crud.js
methods. Curious if that did not work for you?
s
@adorable-action-51248 @faint-table-42725 I did what you guys said and I made a 'barebones' version but it still doesn't seem to work. Code + Output: https://hastebin.com/ogebubinib.js
if you look at example they use callback factory
may be that helps
s
@adorable-action-51248 I got a deployment failure:
Copy code
Build failed: {"error": {"canonicalCode": "INVALID_ARGUMENT", "errorMessage": "`gen_package_lock` had stderr output:\nnpm ERR! Maximum call stack size exceeded\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /builder/home/.npm/_logs/2020-04-09T12_17_01_397Z-debug.log\n\nerror: `gen_package_lock` returned code: 1", "errorType": "InternalError", "errorId": "F9FB3220"}}
a
😞 how does your code look like ?
s
@adorable-action-51248 https://hastebin.com/omitazoyah.js
Pretty empty
a
nvm
πŸ˜‰
s
? πŸ€”
@adorable-action-51248 you are making me curious now.
a
you need to return the app
πŸ˜„
s
🀦
Updating now
Then I need to look how I require/deploy an extra file (next to index.js)
-index.js -crud.js
a
contents of the functions are deployed via pulumi up. i think crud.js is picked up from node modules.
automatically.
s
But it isn't a node module though
mmh..
good question.
s
It's a .js file
a
then
give it a shot ? πŸ˜„
you can first deploy with out it
and without the require of course
and then see if that works.
and then second step add the require in
and then check if the packaging picks it up
s
Did that with my previous code, required it as you normally would but didn't work. 'Main' from package.json only accepts 1 file so that's also a no go. πŸ˜•
Couldn't require index.js and crud.js
If it would be possible it would upload both
a
without crud.js it works right ?
s
Apparantly not:
Copy code
Diagnostics:
  gcp:cloudfunctions:Function (pulumi-test):
    error: 1 error occurred:
        * creating urn:pulumi:dev::gcp::gcp:cloudfunctions:CallbackFunction$gcp:cloudfunctions/function:Function::pulumi-test: Error waiting for Creating CloudFunctions Function: Error code 3, message: Build failed: Build error details not available

  pulumi:pulumi:Stack (gcp-dev):
    error: update failed

    The Pulumi runtime detected that 34 promises were still active
    at the time that the process exited. There are a few ways that this can occur:
      * Not using `await` or `.then` on a Promise returned from a Pulumi API
      * Introducing a cyclic dependency between two Pulumi Resources
      * A bug in the Pulumi Runtime
    Leaving promises active is probably not what you want. If you are unsure about
    why you are seeing this message, re-run your program with the `PULUMI_DEBUG_PROMISE_LEAKS`
    environment variable. The Pulumi runtime will then print out additional
    debug information about the leaked promises.
@adorable-action-51248
a
do you get this for preview or only when you deploy ?
s
@adorable-action-51248 when I deploy it
a
weird
i used the code and was able to deploy it
after adding the return statement. πŸ˜‰
how does your package.json look like ?
s
Copy code
{
  "name": "gcp",
  "main": "index.js",
  "dependencies": {
    "@pulumi/gcp": "^2.0.0",
    "@pulumi/pulumi": "^1.0.0",
    "express": "^4.17.1",
    "allCrud": "file:."
  }
}
(Currently not using 'allCrud' @adorable-action-51248)
a
you are missing body-parser in the requirements
but the error message should look different.
i wonder if allCrud messes with pulumi
s
@adorable-action-51248 I know this sounds weird but the file is getting all node_modules from another folder (I make a 'switch' that chooses which api to deploy on which platform)
So it's getting the node modules from the actual root instead of that folder
a
ah.
that’s the normal node resolution
you can just run npm install in the gcp folder right ?
that should create the node_modules right there
s
@adorable-action-51248 alright, so, status update: It does now deploy (emptied npm's cache and installed the latest pulumi version) and now it does deploy however I now get "Error Forbidden, your client does not have permission to get URL /pulumi-test-7777c9b/ from this server". It looks like GCP still does run into a npm error.
This is the output of GCP
Deployment failure:
Copy code
Build failed: {"error": {"canonicalCode": "INVALID_ARGUMENT", "errorMessage": "`gen_package_lock` had stderr output:\nnpm ERR! Maximum call stack size exceeded\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /builder/home/.npm/_logs/2020-04-14T08_50_30_907Z-debug.log\n\nerror: `gen_package_lock` returned code: 1", "errorType": "InternalError", "errorId": "79DA4BF7"}}
a
mmh. weird errors. may be someone of pulumi could help with these ?
@stale-knife-36790 there are EU office-hours now πŸ˜„
s
@adorable-action-51248 What's that for? πŸ€”
a
may be those guys can help you with your problem πŸ˜„
since they are from pulumi and might have seen the issue.
s
Thanks! I just joined! Otherwhise I might tag a pulumi staff member in this thread ^^
🍻 2