JV
11/07/2022, 3:15 PM"errorMessage": "HTTP Error 404: Not Found"
I am passing API URL <https://api.prefect.io>
. I understand that this documentation is not latest and I also tried URL <https://api.prefect.cloud/>
and getting same error. Request your inputs regarding this error in Prefect version 2.0Ryan Peden
11/07/2022, 3:34 PMRyan Peden
11/07/2022, 3:56 PMJV
11/07/2022, 4:38 PMNate
11/07/2022, 5:13 PM<https://api.prefect.cloud/api/accounts/UUID/workspaces/UUID>
is that how yours looks?JV
11/07/2022, 5:30 PM<https://api.prefect.cloud/>
can you please let me know if I need to dynamically pass UUID to the URL you have mentioned above and where will I get that?Nate
11/07/2022, 5:37 PMprefect config view
locally you can see what your URL should be (provided you've setup a profile, otherwise here are the docs)
and that's what you should set as the PREFECT_API_URL in the env vars for your lambdaJV
11/07/2022, 5:53 PM"HTTP Error 405: Method Not Allowed"
Do we need to set any permissions in prefect cloud to allow POST requests on cloud API?Nate
11/07/2022, 6:20 PMJV
11/08/2022, 1:36 AMbucket = event['Records'][0]['s3']['bucket']['name']
key = event['Records'][0]['s3']['object']['key']
input_file = "s3://"+bucket+"/"+key
create_mutation = """
mutation($input: create_flow_run_input!){
create_flow_run(input: $input){
id
}
}
"""
inputs = dict(flow_id=os.getenv("PREFECT__FLOW_ID"))
inputs['file'] = input_file
variables = dict(input=inputs)
data = json.dumps(
dict(query=create_mutation, variables=json.dumps(variables))
).encode("utf-8")
## prepare the request
req = urllib.request.Request(os.getenv("PREFECT__CLOUD__API"), data=data)
req.add_header("Content-Type", "application/json")
req.add_header(
"Authorization", "Bearer {}".format(os.getenv("PREFECT__CLOUD__API_KEY"))
)
## send the request and return the response
resp = urllib.request.urlopen(req)
return json.loads(resp.read().decode())
Nate
11/08/2022, 1:41 AMNate
11/08/2022, 1:43 AMJV
11/08/2022, 12:58 PMBring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.
Powered by